Styling

One value type — AIAutocompleteAppearance — holds every visual token: fonts, colors, radii, spacing, animation. Defaults follow the stock design and adapt to light/dark automatically.

Applying an appearance

Build a value, override what you need, and apply it — the environment modifier in SwiftUI, the appearance property in UIKit.

BrandAppearance.swift
import AIAutocompleteUIKit
var brand = AIAutocompleteAppearance()
brand.font = .systemFont(ofSize: 16)
brand.inputCornerRadius = 12
brand.pillBackgroundColor = .systemIndigo.withAlphaComponent(0.2)
brand.columns = 2
// SwiftUI — applies to every AIAutocomplete / AIAutocompleteDropdown below it
AIAutocomplete(configuration: config)
.aiAutocompleteAppearance(brand)
// UIKit — assign to the view; restyles in place
autocompleteView.appearance = brand

Light and dark mode

Every default color is a dynamic UIColor that resolves against the system appearance — light and dark both look right with no work. Custom colors can do the same: pass a UIColor closure keyed on userInterfaceStyle, or an asset-catalog color.

DynamicColors.swift
var appearance = AIAutocompleteAppearance()
appearance.inputBackgroundColor = UIColor { traits in
traits.userInterfaceStyle == .dark ? .black : .white
}

Typography

PropTypeDefaultDescription
fontUIFont14pt system, Dynamic TypeBase font for input text and completed params; pills and options fall back to it. Scales with Dynamic Type.
pillFontUIFont?nil (falls back to font)Pill chip font.
optionFontUIFont?14pt system, Dynamic TypeDropdown option font.
maxInputLinesInt?5Lines the input grows to before scrolling internally. nil grows without bound.
lineSpacingCGFloat4Extra spacing between wrapped input lines, in points.
maximumContentSizeCategoryUIContentSizeCategory.accessibilityExtraLargeDynamic Type cap for option text — scales up to this category and no further.

Colors

All UIColor. Defaults are dynamic light/dark pairs mirroring the web SDK's stock palette.

PropTypeDefaultDescription
textColorUIColorFree-typed text and completed params in the input.
placeholderColorUIColorPlaceholder text and unfilled placeholder pills.
caretColorUIColorThe text caret.
pillBackgroundColor / pillTextColorUIColorPill chip fill and text.
inputBackgroundColor / inputBorderColorUIColorInput surface fill and border.
dropdownBackgroundColor / dropdownBorderColorUIColorDropdown surface fill and border (solid mode).
optionTextColor / optionSelectedTextColorUIColorOption text, normal and highlighted.
optionHighlightBackgroundColorUIColorHighlighted option's background fill.
shimmerColorUIColorLoading shimmer / skeleton base.
submitButtonBackgroundColor / submitButtonForegroundColorUIColorBuilt-in submit button fill and glyph. Ignored with a custom button.

Layout

PropTypeDefaultDescription
inputCornerRadiusCGFloat12Input surface radius.
dropdownCornerRadiusCGFloat12Dropdown card radius.
pillCornerRadiusCGFloat16Pill chip radius, clamped to half the chip height — capsules by default.
optionCornerRadiusCGFloat4Highlighted option fill (and streak) radius.
inputBorderWidth / dropdownBorderWidthCGFloat0.8 / 0.2Hairline borders around the input and dropdown.
inputInsetsUIEdgeInsets10pt all sidesPadding between the input surface's edge and its content.
dropdownGapCGFloat6Vertical gap between input and dropdown.
dropdownMaxHeightCGFloat?nilOptional hard cap on the option grid's height. The keyboard bound always applies.
dropdownShadowShadow?.defaultDrop shadow cast by the dropdown card — the stock .default is a soft shadow (offset y 8pt, blur radius 6pt). nil draws no shadow. Solid mode only; glass supplies its own depth.
columnsInt1Columns in the option grid.
submitButtonSize / submitButtonSpacingCGFloat28 / 12Built-in submit button diameter and its gap from the text.

Animation, haptics, surfaces

PropTypeDefaultDescription
animationsBooltrueMaster switch for the selection streak and shimmer. The system Reduce Motion setting always wins.
hapticsBooltrueLight haptic tick on param promotion. Independent of animations.
dropdownSurface.solid | .glass.solidSolid fill, or system glass.