Molecules
Small groups of atoms combined into one interactive unit — fields, pickers, rows, and the travel-booking building blocks.
81 molecules. Every example below feeds modifiers with semantic color
tokens (SemanticColor cases, theme.foreground(_:)…) — never a raw Color or CGFloat
literal. See the DocC reference for the full API.
AmenityGrid {#amenitygrid}
Section titled “AmenityGrid {#amenitygrid}”Icon+label amenity grid with progressive disclosure.
AmenityGrid([Amenity("Free Wi-Fi", systemImage: "wifi"), …]).columns(2).size(.medium).limit(4).highlighted(["Free Wi-Fi"])Autocomplete {#autocomplete}
Section titled “Autocomplete {#autocomplete}”Text field with a suggestion list, synchronous or async.
Autocomplete("Destination", text: $text, suggestions: items)// async: Autocomplete(text: $text, suggest: { await api.search($0) })Breadcrumbs {#breadcrumbs}
Section titled “Breadcrumbs {#breadcrumbs}”A path trail that collapses long paths behind an ellipsis.
Breadcrumbs([.init("Home", action: { }), .init("Current")], maxItems: 4)PrimaryButton / SecondaryButton / OutlineButton / GhostButton / LinkButton {#button}
Section titled “PrimaryButton / SecondaryButton / OutlineButton / GhostButton / LinkButton {#button}”The preset button family — five semantic styles sharing one modifier vocabulary (.size .fullWidth .loading …).
PrimaryButton("Continue") { }ButtonGroup {#buttongroup}
Section titled “ButtonGroup {#buttongroup}”Lays out a row of buttons as one connected group.
ButtonGroup { PrimaryButton("OK") { } }CalendarView {#calendar}
Section titled “CalendarView {#calendar}”Month calendar with date selection.
CalendarView(selection: $date)Checkbox {#checkbox}
Section titled “Checkbox {#checkbox}”A single checkbox with a label and validation info messages.
Checkbox("Accept terms", isChecked: $on).accent(.success).infoMessages(error ? [.init("Required", kind: .error)] : [])CheckboxGroup {#checkboxgroup}
Section titled “CheckboxGroup {#checkboxgroup}”A group of checkboxes bound to a selection set.
CheckboxGroup(options: items, selection: $set) { $0 }ImageChip / CompactChip / ChoseChip / FilterChip / ChipGroup {#chips}
Section titled “ImageChip / CompactChip / ChoseChip / FilterChip / ChipGroup {#chips}”The chip family — image, compact, price, and filter chips, plus ChipGroup for laying several out together.
CompactChip("Suit", price: "$899", isSelected: $on).rating(4.6) // ChoseChip · ImageChip · FilterChip · ChipGroupColorField {#colorfield}
Section titled “ColorField {#colorfield}”A labeled color-swatch field bound to a Color selection.
ColorField("Brand color", selection: $color).supportsOpacity()CurrencyPicker {#currencypicker}
Section titled “CurrencyPicker {#currencypicker}”Searchable currency picker with a recents section.
CurrencyPicker(selection: $code, currencies: Currency.common).showsName().searchable().recents(recent)DateField {#datefield}
Section titled “DateField {#datefield}”Date picker field with formatting styles and a locale.
DateField("Check-in", date: $date).style(.custom("EEE, d MMM")).clearable()DatePriceCard {#datepricecard}
Section titled “DatePriceCard {#datepricecard}”A single selectable date + price card, as used inside DatePriceStrip.
DatePriceCard(DatePriceItem("18 Jul", price: 1_767.99), isSelected: true) { pick() }.currency("TRY").cheapest()DatePriceStrip {#datepricestrip}
Section titled “DatePriceStrip {#datepricestrip}”A horizontal strip of date + price cards; DatePriceCard is a single selectable card.
DatePriceStrip([DatePriceItem("18 Jul", price: 1_767.99), …], selection: $i).columns(3).highlightCheapest()Dropdown {#dropdown}
Section titled “Dropdown {#dropdown}”Anchored action menu with item roles, dividers, and edge placement.
Dropdown(items: [.init("Rename", systemImage: "pencil"), .divider, .init("Delete", systemImage: "trash", role: .destructive)]) { trigger }.edge(.bottomTrailing)FieldButton {#fieldbutton}
Section titled “FieldButton {#fieldbutton}”A field-styled button that opens a picker or sheet.
FieldButton("2 Passengers · Economy") { openSheet() }.label("Passengers").icon("person.2.fill")Fieldset {#fieldset}
Section titled “Fieldset {#fieldset}”Groups fields under a title with helper text.
Fieldset("Contact") { inputs }.helper("…")FileInput {#fileinput}
Section titled “FileInput {#fileinput}”File picker field with the picked file’s name on display.
FileInput("Passport") { pick() }.fileName(name)FilterGroup {#filtergroup}
Section titled “FilterGroup {#filtergroup}”A group of filter options bound to a single selection.
FilterGroup(options: items, selection: $sel) { $0 }FilterRow {#filterrow}
Section titled “FilterRow {#filterrow}”A labeled checkbox filter row with a result count.
FilterRow("Direct", isOn: $direct).count(128).icon("airplane") // Checkbox atom + title + countFlightRoute {#flightroute}
Section titled “FlightRoute {#flightroute}”Origin → destination route line with stop count.
FlightRoute(from: "IST", to: "AYT", departure: dep, arrival: arr).stops(1).nextDay()GuestSelector {#guestselector}
Section titled “GuestSelector {#guestselector}”Rooms & guests stepper group for travel booking flows.
GuestSelector(selection: $guests).showsRooms(true).showsInfants(false).maxTotal(9)InputNumber {#inputnumber}
Section titled “InputNumber {#inputnumber}”Stepper-backed numeric field with a range, step, and unit.
InputNumber("Max price", value: $n, range: 0...10000).step(50).unit("$")InstallmentPicker {#installmentpicker}
Section titled “InstallmentPicker {#installmentpicker}”Installment option picker with monthly and total amounts.
InstallmentPicker([InstallmentOption(count: 3, total: 9_900, monthly: 3_300), …], selection: $count).currency("TRY")InstallmentSelector {#installmentselector}
Section titled “InstallmentSelector {#installmentselector}”Installment plan picker with interest-free and recommended badges.
InstallmentSelector(total: 12_000, options: [1, 3, 6, 12], selection: $months).interestFreeUpTo(3).recommended(6).surcharge([12: 750])LayoverRow {#layoverrow}
Section titled “LayoverRow {#layoverrow}”A layover duration row with a short-connection warning state.
LayoverRow(duration: "2h 15m", airport: "Istanbul (IST)").warning("Short connection")MapPriceMarker {#mappricemarker}
Section titled “MapPriceMarker {#mappricemarker}”Price pill annotation for map pins.
MapPriceMarker("₺1.250").selected(isActive).icon("heart.fill") // in any Map annotationMultiLineTextInput {#multilinetextinput}
Section titled “MultiLineTextInput {#multilinetextinput}”Multi-line text field with a character counter.
MultiLineTextInput("Notes", text: $text).size(.small).characterLimit(200).countStyle(.remaining)MultiSelect {#multiselect}
Section titled “MultiSelect {#multiselect}”Multi-selection dropdown field.
MultiSelect("Cities", options: items, selection: $set) { $0 }.optionEnabled { $0.inStock }.loading(loading)OTPInput {#otpinput}
Section titled “OTPInput {#otpinput}”One-time-passcode digit entry with a resend timer.
OTPInput(code: $code) { verify($0) } .digitCount(6).secure().resend(interval: 30) { resend() }Pagination {#pagination}
Section titled “Pagination {#pagination}”Numbered page navigation with a jump-to-page control.
Pagination(current: $page, total: 50).window(sibling: 2).jumper()PassengerRow {#passengerrow}
Section titled “PassengerRow {#passengerrow}”A passenger summary row with seat and check-in status.
PassengerRow("Alex Morgan").type("Adult").subtitle("Passport · TR12345").seat("14C").status("Checked in").onEdit { }PaymentCardField {#paymentcardfield}
Section titled “PaymentCardField {#paymentcardfield}”Card number/expiry/CVV field with brand auto-detection.
PaymentCardField(number: $n, expiry: $e, cvv: $c).holder($name) // brand auto-detect + 4-4-4-4 / MM/YYPriceBreakdown {#pricebreakdown}
Section titled “PriceBreakdown {#pricebreakdown}”Itemized price breakdown with discounts and extras.
PriceBreakdown(190_960).note("2 rooms · 4 nights").original(248_000).discountBadge("-23%").extra("Extra 8%", 175_683)PriceHistogram {#pricehistogram}
Section titled “PriceHistogram {#pricehistogram}”Price-distribution bars layered over a range slider.
PriceHistogram(bins: counts, lowerValue: $low, upperValue: $high, in: 0...5_000).showsBounds().resultCount(n)PriceTrendChart {#pricetrendchart}
Section titled “PriceTrendChart {#pricetrendchart}”Per-day fare bar chart with paging.
PriceTrendChart(points, selection: $day).title("July").onPage(prev: …, next: …) // per-day fare barsProgressIndicator {#progressindicator}
Section titled “ProgressIndicator {#progressindicator}”Step, carousel, or video progress readout.
ProgressIndicator(variant: .carousel, current: 2, total: 8).stepText(.slash)QuantityStepper {#quantitystepper}
Section titled “QuantityStepper {#quantitystepper}”A +/- stepper bound to a numeric range.
QuantityStepper(value: $qty, range: 0...10)RadioButton {#radiobutton}
Section titled “RadioButton {#radiobutton}”A single radio option bound to a selection.
RadioButton(isSelected: $on).accent(.error)RadioGroup / RadioButtonGroup {#radiogroup}
Section titled “RadioGroup / RadioButtonGroup {#radiogroup}”A group of radio options bound to a selection; RadioButtonGroup is the tag-based variant.
RadioGroup(options: items, selection: $sel) { $0 }RangeSlider {#rangeslider}
Section titled “RangeSlider {#rangeslider}”Dual-handle range slider with marks.
RangeSlider(lowerValue: $lo, upperValue: $hi, in: 0...1000).step(50).marks([0, 500, 1000]).onChangeEnd(search)RecentSearchRow {#recentsearchrow}
Section titled “RecentSearchRow {#recentsearchrow}”A recent-search summary row with a rerun action.
RecentSearchRow(from: "IST", to: "AYT") { rerun() }.roundTrip().dates("18 – 27 Jul").passengers("2 adults · Economy").onRemove { }ScrubGallery {#scrubgallery}
Section titled “ScrubGallery {#scrubgallery}”Finger-scrub image gallery — drag across to flip pages.
ScrubGallery(images).accent(.primary) // scrub a finger across to flip pagesSearchBar {#searchbar}
Section titled “SearchBar {#searchbar}”Search field with suggestions and a recent-searches list.
SearchBar(text: $text).suggestions(cities).recent(recent).onCommit(search)SearchField {#searchfield}
Section titled “SearchField {#searchfield}”A labeled field row that opens a picker — the building block of flight/hotel search forms.
SearchField("From") { openPicker() }.value(code: "IST", title: "Istanbul", subtitle: "All airports")// or fully custom: SearchField("Dates") { }.content { DateRange(…) }.onClear { }SegmentedControl {#segmentedcontrol}
Section titled “SegmentedControl {#segmentedcontrol}”Segmented picker over a set of items.
SegmentedControl([SegmentItem("List", systemImage: "list.bullet")], selection: $i)Select {#select}
Section titled “Select {#select}”Single-selection dropdown field, with optional search and loading state.
Select("City", options: items, selection: $city) { $0 }.searchable().loading(loading)SelectBox {#selectbox}
Section titled “SelectBox {#selectbox}”A lightweight select trigger box.
SelectBox("Country", options: items, selection: $sel) { $0 }Slider {#slider}
Section titled “Slider {#slider}”Single-value slider with marks and a value tooltip.
Slider(value: $v, in: 0...8).marks([0: "0", 8: "Max"]).showsValueTooltip()SmartSuggestion {#smartsuggestion}
Section titled “SmartSuggestion {#smartsuggestion}”An inline algorithmic tip/nudge banner.
SmartSuggestion("Berlin outbound is 12% cheaper on Sat 13 Sep.").label("Smart tip").tint(.success).onTap { }SortSummaryBar {#sortsummarybar}
Section titled “SortSummaryBar {#sortsummarybar}”A row of sort-option summaries; SortTab is a single tab within it.
SortSummaryBar([SortOption("Best", value: "₺2.777", subtitle: "1h 07m", icon: "star.fill"), …], selection: $sort).onMore { }SortTab {#sorttab}
Section titled “SortTab {#sorttab}”A single sort-option tab, as used inside SortSummaryBar.
SortTab(SortOption("Best", value: "₺2.777", subtitle: "1h 07m", icon: "star.fill"), isSelected: true) { select() }Stat {#stat}
Section titled “Stat {#stat}”A labeled statistic with a trend indicator and an icon.
Stat(title: "Bookings", value: "1,284").icon("ticket").trend(.up("+12%"))StepperRow {#stepperrow}
Section titled “StepperRow {#stepperrow}”A labeled +/- counter row (passengers, rooms, quantity).
StepperRow("Adult", value: $adults).subtitle("+12 yrs").range(1...9) // passenger/room/quantity counterSteps {#steps}
Section titled “Steps {#steps}”Numbered step tracker with a state per step.
Steps([.init("Cart", description: "2 items", state: .done), .init("Pay", state: .error)]) { active = $0 }SuggestionRow {#suggestionrow}
Section titled “SuggestionRow {#suggestionrow}”A single search-suggestion row, with nested sub-airport support.
SuggestionRow("Ankara, Turkey") { pick() }.icon("airplane").code("ANK").subtitle("Any").highlight(query) // .nested() for sub-airportsTextInput {#textinput}
Section titled “TextInput {#textinput}”The primary text field — icons, addons, formatting, and declarative validation.
TextInput("Email", text: $t).keyboard(.emailAddress, contentType: .emailAddress, submit: .next)ThemeButton {#themebutton}
Section titled “ThemeButton {#themebutton}”A single configurable button — color, variant, size, and shape all as modifiers.
ThemeButton("Save") { }.color(.success).variant(.soft).size(.medium).shape(.pill)ThemeController {#themecontroller}
Section titled “ThemeController {#themecontroller}”A picker for switching between named themes.
ThemeController(options: [.init(name: "oceanTheme", label: "Ocean")], selectedName: $name)ThemeToggle {#themetoggle}
Section titled “ThemeToggle {#themetoggle}”Light/dark theme switch.
ThemeToggle(isOn: $on).accent(.success).symbols(on: "checkmark")ToggleGroup {#togglegroup}
Section titled “ToggleGroup {#togglegroup}”A group of toggle switches bound to a selection set.
ToggleGroup(options: items, selection: $set, label: { $0 })Tooltip {#tooltip}
Section titled “Tooltip {#tooltip}”Anchored hint bubble with a placement edge and a color.
anchorView.tooltip("Hint", isPresented: $shown, edge: .top, color: .primary)TreeSelect {#treeselect}
Section titled “TreeSelect {#treeselect}”Hierarchical tree selection field with cascading selection.
TreeSelect("Cities", nodes: tree, selection: $set, initiallyExpanded: ["tr"]).cascade().searchable()TripTypeToggle {#triptypetoggle}
Section titled “TripTypeToggle {#triptypetoggle}”One-way / round-trip / multi-city segmented toggle.
TripTypeToggle(["One way", "Round trip", "Multi-city"], selection: $trip).icons([…])Space {#space}
Section titled “Space {#space}”Even spacing between inline or stacked children — direction, size, align, wrap (Ant Space).
Space { Button("Save") { }; Button("Cancel") { } }.size(.large).wrap()Flex {#flex}
Section titled “Flex {#flex}”A flexbox container with main-axis justify and cross-axis align distribution (Ant Flex).
Flex { Tag("A"); Tag("B"); Tag("C") }.justify(.spaceBetween).align(.center)AnchorNav {#anchor}
Section titled “AnchorNav {#anchor}”A scroll-spy link rail; the active section highlights as you scroll (Ant Anchor).
AnchorNav(sections, active: $current).onSelect { proxy.scrollTo($0, anchor: .top) }Splitter {#splitter}
Section titled “Splitter {#splitter}”Two panes separated by a draggable, clamped divider (Ant Splitter).
Splitter(.horizontal) { Sidebar() } second: { Detail() }.bounds(min: 0.2, max: 0.8)Cascader {#cascader}
Section titled “Cascader {#cascader}”Pick a value from a multi-level option tree, one column per level (Ant Cascader).
Cascader(regions, selection: $path).placeholder("Region")Transfer {#transfer}
Section titled “Transfer {#transfer}”Move items between a source and a target list with checkboxes + arrows (Ant Transfer).
Transfer(items, target: $enabled).titles("Available", "Enabled")Mentions {#mentions}
Section titled “Mentions {#mentions}”A textarea where typing @ opens a filterable mention list (Ant Mentions).
Mentions(text: $note, options: teammates).placeholder("Write a note…")Masonry {#masonry}
Section titled “Masonry {#masonry}”A Pinterest-style grid; items flow into the shortest column (Ant Masonry).
Masonry { ForEach(photos) { Card($0) } }.columns(2).spacing(.sm)TreeView {#tree}
Section titled “TreeView {#tree}”A hierarchical tree with expand/collapse and optional cascade checkboxes (Ant Tree).
TreeView(nodes, selection: $checked).checkable()ColumnsGrid {#grid}
Section titled “ColumnsGrid {#grid}”An equal-column grid with a token gutter; fixed or responsive-adaptive (Ant Grid).
ColumnsGrid { ForEach(items) { Card($0) } }.columns(3).gutter(.md)