Bootstrap¶
Imitates: Bootstrap 5.3 (as used directly or through React-Bootstrap / ng-bootstrap), default theme 5.3 · Pack id: bootstrap · Selected by: pack="bootstrap", import Bootstrap, import ReactBootstrap · Default device: desktop (browser chrome)
85 own elements, plus 117 core elements in this pack's style. Each entry shows the element rendered with sample arguments (and, for the pack's own elements, each of its variants), the role it maps onto, its positional arguments, its defaults and variants.
Pack elements¶
Accordion¶
Accordion { AccordionItem… } · .flush()
role vstack · defaults alignment: "stretch", spacing: 0
Source
Accordion() { Text("Content"); Button("Action") }AccordionItem¶
AccordionItem("Item #1", expanded: true) { body }
role accordion · arguments title
Source
AccordionItem("Title") { Text("Content"); Button("Action") }Alert¶
Alert("Saved!", variant: "success", title:, dismissible: true) { AlertLink… }
role alert · arguments message · defaults showIcon: False, variant: "primary" · variants primary, secondary, success, danger, warning, info, light, dark
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("primary"); Text("primary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("secondary"); Text("secondary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("success"); Text("success").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("danger"); Text("danger").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("warning"); Text("warning").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("info"); Text("info").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("light"); Text("light").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Alert("Message").variant("dark"); Text("dark").font(.caption).foregroundStyle(.secondary) }
}AlertHeading¶
An alert heading
role text · arguments content · defaults font: "h4"
Source
AlertHeading("Content")AlertLink¶
A bold link coloured for its alert
role link · arguments label
Source
AlertLink("Label")Badge¶
Badge("New").bg(.success) · .pill() · variant: "subtle" (bg--subtle text--emphasis)
role badge · arguments text · defaults color: "primary"
Source
Badge("Text")Breadcrumb¶
Breadcrumb(["Home", "Library", "Data"]) or BreadcrumbItem children
role breadcrumb · arguments items
Source
Breadcrumb(["One", "Two", "Three"])BreadcrumbItem¶
One breadcrumb (the last is the active page)
role text · arguments content
Source
BreadcrumbItem("Content")Button¶
Button("Save", variant: "outline-secondary", size: "sm", systemImage:) · .active() · disabled: true
role button · arguments label · defaults variant: "primary" · variants primary, secondary, success, danger, warning, info, light, dark, link, outline-primary, outline-secondary, outline-success, outline-danger, outline-warning, outline-info, outline-light, outline-dark
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("primary"); Text("primary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("secondary"); Text("secondary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("success"); Text("success").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("danger"); Text("danger").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("warning"); Text("warning").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("info"); Text("info").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("light"); Text("light").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("dark"); Text("dark").font(.caption).foregroundStyle(.secondary) }
}ButtonGroup¶
Joined buttons; size: "sm"|"lg" on the buttons
role toolbar · defaults variant: "group"
Source
ButtonGroup() { Button("Save"); Button("Share") }ButtonToolbar¶
A row of button groups
role toolbar
Source
ButtonToolbar() { Button("Save"); Button("Share") }Card¶
Card("Title", subtitle:, image:) { body } footer: { … } · header: { Text("Featured") } draws a header band
role card · arguments title
Source
Card("Title") { Text("Content"); Button("Action") }CardBody¶
Layout-only wrapper (the Card's children are its body)
role group
Source
CardBody() { Text("Content"); Button("Action") }CardGroup¶
Cards joined edge to edge
role hstack · defaults spacing: 0
Source
CardGroup() { Text("Content"); Button("Action") }CardImg¶
An image inside a card body
role image · arguments name
Source
CardImg().frame(width: 160, height: 96)CardSubtitle¶
card-subtitle (muted)
role text · arguments content · defaults font: "h6"
Source
CardSubtitle("Content")CardTitle¶
card-title inside a body
role text · arguments content · defaults font: "h5"
Source
CardTitle("Content")Carousel¶
One carousel slide: Carousel("First slide", subtitle:, image:, mediaHeight:) with indicators and controls
role card · arguments title
Source
Carousel("Title") { Text("Content"); Button("Action") }CloseButton¶
The btn-close ×
role button · defaults icon: "xmark", iconOnly: True, variant: "close"
Source
CloseButton()Col¶
Grid column: Col() is equal width, Col(6) or .md(6) spans 6 of 12, Col("auto") sizes to content
role vstack · arguments level
Source
Col(1) { Text("Content"); Button("Action") }Container¶
Centered, padded page container (max 1140px on desktop); .fluid() for full width
role vstack
Source
Container() { Text("Content"); Button("Action") }Dropdown¶
Dropdown("Actions", open: true) { DropdownItem… }
role menu · arguments title · defaults variant: "primary"
Source
Dropdown("Title") { Button("Open"); Button("Save"); Divider(); Button("Close") }DropdownButton¶
DropdownButton("Filter", variant: "outline-secondary", open: true) { DropdownItem… }
role menu · arguments title · defaults variant: "primary"
Source
DropdownButton("Title") { Button("Open"); Button("Save"); Divider(); Button("Close") }DropdownHeader¶
Small muted heading inside a dropdown
role text · arguments content
Source
DropdownHeader("Content")DropdownItem¶
DropdownItem("Edit", systemImage:) · .active() · disabled: true
role menuitem · arguments label
Source
DropdownItem("Label")DropdownItemText¶
Non-interactive text inside a dropdown
role text · arguments content
Source
DropdownItemText("Content")DropdownMenu¶
A static, always-visible dropdown menu
role menu
Source
DropdownMenu() { Button("Open"); Button("Save"); Divider(); Button("Close") }DropdownToggle¶
A button with a caret
role button · arguments label · defaults dropdown: True, variant: "primary"
Source
DropdownToggle("Label")Figure¶
Figure { FigureImage(…); FigureCaption(…) }
role vstack · defaults alignment: "leading", spacing: 8
Source
Figure() { Text("Content"); Button("Action") }FigureCaption¶
figure-caption (muted, small)
role text · arguments content
Source
FigureCaption("Content")FigureImage¶
figure-img
role image · arguments name
Source
FigureImage().frame(width: 160, height: 96)FloatingLabel¶
FloatingLabel("Email address", text: "name@example.com")
role textfield · arguments label · defaults variant: "floating"
Source
FloatingLabel("Label")Form¶
Form { FormGroup… ; Button } (no padding; 16px between groups)
role form
Source
Form() { TextField("Name"); Toggle("Notifications", isOn: true) }FormCheck¶
Checkbox: FormCheck("Remember me", checked: true)
role toggle · arguments label · defaults variant: "checkbox"
Source
FormCheck("Label")FormControl¶
FormControl("name@example.com", label:, text:, type: "email"|"password"|"textarea", size: "sm"|"lg", helper:) · .isInvalid() · .plaintext()
role textfield · arguments placeholder
Source
FormControl("Placeholder")FormControlFeedback¶
invalid-feedback text; kind: "valid" for valid-feedback
role text · arguments content
Source
FormControlFeedback("Content")FormFloating¶
Layout-only wrapper
role group
Source
FormFloating() { Text("Content"); Button("Action") }FormGroup¶
A label + control + help text group
role vstack · defaults alignment: "stretch", spacing: 0
Source
FormGroup() { Text("Content"); Button("Action") }FormRadio¶
Radio (Form.Check type="radio"): FormRadio("Credit card", checked: true)
role radio · arguments label
Source
FormRadio("Label")FormRange¶
FormRange("Volume", value: 40, in: 0...100)
role slider · arguments label
Source
FormRange("Label")FormSelect¶
FormSelect("Choose…", label:) { Text("One") … } · open: true
role select · arguments selection
Source
FormSelect()FormSwitch¶
Switch: FormSwitch("Notifications", checked: true)
role toggle · arguments label
Source
FormSwitch("Label")FormText¶
Muted help text under a control
role text · arguments content
Source
FormText("Content")Image¶
Image("photo.jpg") · .rounded() · .roundedCircle() · .thumbnail() · .fluid()
role image · arguments name
Source
Image().frame(width: 160, height: 96)InputGroup¶
InputGroup { InputGroupText("@"); FormControl("Username") } — joined controls
role hstack · defaults spacing: 0
Source
InputGroup() { Text("Content"); Button("Action") }InputGroupText¶
An add-on box inside an InputGroup
role text · arguments content
Source
InputGroupText("Content")ListGroup¶
ListGroup { ListGroupItem… } · .flush() · .numbered() · .horizontal()
role list · variants flush
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ListGroup() { Text("First item"); Text("Second item") }.variant("flush"); Text("flush").font(.caption).foregroundStyle(.secondary) }
}ListGroupItem¶
ListGroupItem("Inbox", subtitle:, detail:) .badge(14) · .active() · .action() · variant: "success"
role listitem · arguments title · variants primary, secondary, success, danger, warning, info, light, dark
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("primary"); Text("primary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("secondary"); Text("secondary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("success"); Text("success").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("danger"); Text("danger").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("warning"); Text("warning").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("info"); Text("info").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("light"); Text("light").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListGroupItem("Title").variant("dark"); Text("dark").font(.caption).foregroundStyle(.secondary) }
}Modal¶
Modal("Title") { body } footer: { Button… } · size: "sm"|"lg"|"xl" · .centered() · inline: true
role dialog · arguments title · defaults closeButton: True, variant: "modal"
Source
Modal("Title") { Text("Content"); Button("Action") }Nav¶
Nav { NavLink("Home").active(); NavLink("Link") } · variant: "tabs"|"pills"|"underline" · .class("flex-column")
role tabs · arguments items · defaults placement: "top" · variants tabs, pills, underline
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Nav(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("tabs"); Text("tabs").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Nav(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("pills"); Text("pills").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Nav(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("underline"); Text("underline").font(.caption).foregroundStyle(.secondary) }
}NavDropdown¶
A nav link with a dropdown menu; open: true shows it
role menu · arguments title · defaults variant: "nav"
Source
NavDropdown("Title") { Button("Open"); Button("Save"); Divider(); Button("Close") }NavLink¶
NavLink("Home", systemImage:) · .active() · disabled: true
role tab · arguments label
Source
NavLink("Label")Navbar¶
Navbar(brand: "Acme") { Nav { NavLink… }; Button… } · .bg(.dark) / .bg(.primary) / variant: "dark"
role appbar · arguments brand · defaults color: "body-tertiary" · variants light, dark
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Navbar("Brand") { Text("Content"); Button("Action") }.variant("light"); Text("light").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Navbar("Brand") { Text("Content"); Button("Action") }.variant("dark"); Text("dark").font(.caption).foregroundStyle(.secondary) }
}NavbarBrand¶
The brand text inside a Navbar
role text · arguments content
Source
NavbarBrand("Content")NavbarCollapse¶
Groups the collapsible part of a Navbar (layout only)
role group
Source
NavbarCollapse() { Text("Content"); Button("Action") }NavbarText¶
Plain text inside a Navbar
role text · arguments content
Source
NavbarText("Content")NavbarToggle¶
The collapsed-navbar hamburger toggler
role button · defaults icon: "line.3.horizontal", iconOnly: True, variant: "toggler"
Source
NavbarToggle()Offcanvas¶
Offcanvas("Menu") { body } · placement: "end"
role dialog · arguments title · defaults closeButton: True, variant: "offcanvas"
Source
Offcanvas("Title") { Text("Content"); Button("Action") }Pagination¶
Pagination(count: 10, page: 2) · size: "sm"|"lg"
role pagination
Source
Pagination()Placeholder¶
Loading placeholder bar: Placeholder(6) or .xs(6) spans 6/12 · size: "lg"|"sm"|"xs" · .animation(.glow)
role shape · arguments level
Source
Placeholder(1).frame(width: 160, height: 96)PlaceholderButton¶
A placeholder in button shape
role button · arguments level · defaults variant: "primary"
Source
PlaceholderButton(1)Popover¶
Popover("Title", "Body text") { trigger } · placement: .bottom
role tooltip · arguments title, message · defaults placement: "right"
Source
Popover("Title", "Message") { Text("Content"); Button("Action") }ProgressBar¶
ProgressBar(60, label: "60%", variant: "success") · .striped()
role progress · arguments value
Source
ProgressBar(60)Ratio¶
Ratio("16x9") { content } — 1x1, 4x3, 16x9, 21x9
role zstack · arguments kind
Source
Ratio() { Text("Content"); Button("Action") }Row¶
Flex grid row with 24px gutters; .gap(0…5) sets the gutter (g-*)
role hstack · defaults wrap: True
Source
Row() { Text("Content"); Button("Action") }SplitButton¶
A button with a separate caret toggle
role menu · arguments title · defaults variant: "primary"
Source
SplitButton("Title") { Button("Open"); Button("Save"); Divider(); Button("Close") }Stack¶
Flex stack: .direction(.horizontal) for hstack, .gap(0…5) for the spacer scale
role vstack
Source
Stack() { Text("Content"); Button("Action") }TabContainer¶
Layout-only wrapper
role group
Source
TabContainer() { Text("Content"); Button("Action") }TabContent¶
Layout-only wrapper
role group
Source
TabContent() { Text("Content"); Button("Action") }TabPane¶
Layout-only wrapper
role group
Source
TabPane() { Text("Content"); Button("Action") }Table¶
Table(columns:, rows:) · .striped() .hover() .bordered() .borderless() .size(.sm) · variant: "dark"
role table
| Name | Status |
|---|---|
| Ana Lima | Active |
| Ben Okafor | Away |
Source
Table(columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])Tabs¶
Tabs(selection: "Profile") { Tab("Home") { … } … } — nav tabs with panes
role tabs · defaults placement: "top", variant: "tabs" · variants tabs, pills, underline
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Tabs() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("tabs"); Text("tabs").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Tabs() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("pills"); Text("pills").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Tabs() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("underline"); Text("underline").font(.caption).foregroundStyle(.secondary) }
}Toast¶
Toast("Bootstrap", status: "11 mins ago", systemImage:) { Text(body) } · .bg(.primary)
role card · arguments title
Source
Toast("Title") { Text("Content"); Button("Action") }ToastBody¶
Layout-only wrapper
role group
Source
ToastBody() { Text("Content"); Button("Action") }ToastContainer¶
Positions toasts over the screen: position: "top-end"|"top-start"|"bottom-end"|… · inline: true
role dialog · defaults position: "top-end", variant: "toast-container"
Source
ToastContainer() { Text("Content"); Button("Action") }ToggleButton¶
ToggleButton("Bold", checked: true) — outline-primary checkable button
role toggle · arguments label · defaults variant: "button"
Source
ToggleButton("Label")ToggleButtonGroup¶
Joined ToggleButtons
role toolbar · defaults variant: "group"
Source
ToggleButtonGroup() { Button("Save"); Button("Share") }Tooltip¶
Tooltip("Hint", placement: .bottom) { trigger }
role tooltip · arguments text · defaults placement: "top"
Source
Tooltip("Text") { Text("Content"); Button("Action") }Core vocabulary in this style¶
Board¶
Kanban board of BoardColumn children
role board
Source
Board() { BoardColumn("To do") { KanbanCard("Write copy") } }BoardColumn¶
BoardColumn("To do", count:, color:) { KanbanCard(…) }
role boardcolumn · arguments title
Source
BoardColumn("Title") { KanbanCard("Write copy"); KanbanCard("Review") }Calendar¶
role calendar
Source
Calendar()Callout¶
a numbered annotation; place with .position(x:y:)
role callout · arguments number, text
Source
Callout(1, "Text")CandlestickChart¶
role chart · defaults kind: "candlestick"
Source
CandlestickChart(values: [3, 5, 2, 6, 4])Canvas¶
free-form area; place children with .position(x:y:); grid: .dots|.lines
role canvas
Source
Canvas() { Text("Content"); Button("Action") }.frame(width: 160, height: 96)Chart¶
kind: .bar|.line|.area|.pie|.donut|.scatter|.bubble|.radar|.heatmap|.funnel|.treemap|.gauge|.candlestick|.combo|.sparkline; values:/series:/labels:/points:/matrix:
role chart
Source
Chart(values: [3, 5, 2, 6, 4])CodeBlock¶
role code · arguments code · defaults lineNumbers: False
Source
CodeBlock("let total = items.count")CodeEditor¶
CodeEditor("…", language: "swift", lineNumbers:, highlight: [3], tabs: [..])
role code · arguments code
Source
CodeEditor("let total = items.count")Comment¶
author:, time:, avatar:
role message · arguments text · defaults variant: "comment"
Source
Comment("Text")ControlGroup¶
role toolbar · defaults variant: "group"
Source
ControlGroup() { Button("Save"); Button("Share") }DatePicker¶
selection: "2026-11-23"; .datePickerStyle(.graphical)
role datepicker · arguments label
Source
DatePicker("Label")Dialog¶
role dialog · arguments title
Source
Dialog("Title") { Text("Content"); Button("Action") }DisclosureGroup¶
role accordion · arguments title
Source
DisclosureGroup("Title") { Text("Content"); Button("Action") }EmptyState¶
title, systemImage:, description: { actions }
role emptystate · arguments title
Source
EmptyState("Title")Gantt¶
scale: ["W1",…], tasks: [("Design", 0, 2, 0.6), …], today:
role gantt
Source
Gantt(tasks: [("Design", 0, 3), ("Build", 2, 5)])Grid¶
Grid of GridRow children, or columns: n
role grid
Source
Grid() { Text("Content"); Button("Action") }GroupBox¶
role card · arguments title
Source
GroupBox("Title") { Text("Content"); Button("Action") }HStack¶
Horizontal stack. spacing:, alignment: .top|.center|.bottom
role hstack
Source
HStack() { Text("Content"); Button("Action") }KanbanCard¶
title, description:, tags: [..], assignees: [..], due:, comments:, priority:
role kanbancard · arguments title
Source
KanbanCard("Title")LabeledContent¶
role labeled · arguments label, value
Source
LabeledContent("Label", "Value") { Text("Content"); Button("Action") }LazyVGrid¶
columns: [GridItem(.flexible()), …] or a count
role grid
Source
LazyVGrid() { Text("Content"); Button("Action") }List¶
.listStyle(.insetGrouped|.plain|.sidebar|…)
role list
Source
List() { Text("First item"); Text("Second item") }Map¶
pins: [(x%, y%, "label")], route:, showsUserLocation:, height:
role map
Source
Map().frame(width: 160, height: 96)Menu¶
role menu · arguments label
Source
Menu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }MessageBubble¶
MessageBubble("Hi", from: .me|.them, author:, time:, status:, reactions: [..])
role message · arguments text
Source
MessageBubble("Text")NavigationLink¶
role listitem · arguments title · defaults chevron: True
Source
NavigationLink("Title")NavigationSplitView¶
{ sidebar } content: { … } detail: { … }
role split
Source
NavigationSplitView() { Text("Content"); Button("Action") }NavigationStack¶
Content's .navigationTitle / .toolbar form the bar
role navstack
Source
NavigationStack() { Text("Content"); Button("Action") }Picker¶
Picker("Size", selection: "M") { Text("S") … }
role select · arguments label
Source
Picker("Label")Pointer¶
Pointer(.arrow|.hand|.ibeam|.grab|.crosshair|.touch); place with .position
role pointer · arguments kind
Source
Pointer(.arrow)ProgressView¶
value: 0…1 (or total:); none = indeterminate
role progress · arguments label
Source
ProgressView("Label")RoundedRectangle¶
role shape · defaults shape: "rounded"
Source
RoundedRectangle().frame(width: 160, height: 96)Schedule¶
days: [..], startHour:, endHour:, events: [("Standup", "Mon", 9, 9.5, .blue)], now:
role schedule
Source
Schedule()ScrollView¶
role scroll · arguments axes
Source
ScrollView() { Text("Content"); Button("Action") }SearchField¶
role textfield · arguments placeholder · defaults kind: "search"
Source
SearchField("Placeholder")Section¶
Section("Header") { … } footer: { … }
role section · arguments title
Source
Section("Title") { Text("First item"); Text("Second item") }SecureField¶
role textfield · arguments placeholder · defaults kind: "password"
Source
SecureField("Placeholder")SegmentedControl¶
role segmented · arguments items
Source
SegmentedControl(["One", "Two", "Three"])SelectionRect¶
a drag-selection rectangle; size with .frame, place with .position
role marquee
Source
SelectionRect()Sheet¶
role dialog · arguments title · defaults variant: "sheet"
Source
Sheet("Title") { Text("Content"); Button("Action") }Sidebar¶
role sidebar · arguments title
Source
Sidebar("Title") { Text("Content"); Button("Action") }Skeleton¶
lines:, avatar:, image:, shape: .circle|.rectangle|.text
role skeleton
Source
Skeleton().frame(width: 160, height: 96)Sparkline¶
role chart · arguments values · defaults kind: "sparkline"
Source
Sparkline([3, 5, 2, 6, 4], values: [3, 5, 2, 6, 4])Spreadsheet¶
rows: [[…]], selection: "B2:C4", active:, formula:, sheets: [..], highlight: ["B3": .yellow]
role spreadsheet
| A | B | |
|---|---|---|
| 1 | A | B |
| 2 | 1 | 2 |
| 3 | 3 | 4 |
Source
Spreadsheet(columns: ["A", "B"], rows: [[1, 2], [3, 4]])Stat¶
Stat("Revenue", "$48k", change: "+12%", trend: [..], systemImage:)
role stat · arguments label, value
Source
Stat("Label", 60)Steps¶
role steps · arguments steps
Source
Steps(["Cart", "Shipping", "Payment"])StickyNote¶
StickyNote("Call Ana", color: .yellow, rotation: -2, author:)
role stickynote · arguments text
Source
StickyNote("Text")TabView¶
Children with .tabItem { Label } or Tab(…)
role tabs · defaults placement: "bottom"
Source
TabView() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }Terminal¶
lines starting with "$ " are commands
role code · arguments code · defaults variant: "terminal"
Source
Terminal("let total = items.count")Text¶
Text with bold, italic, code Markdown
role text · arguments content
Source
Text("Content")TextEditor¶
role textfield · arguments text · defaults kind: "multiline"
Source
TextEditor("Text")TextField¶
TextField("Placeholder", text: "value")
role textfield · arguments placeholder
Source
TextField("Placeholder")Timeline¶
role timeline
Source
Timeline() { TimelineItem("Created"); TimelineItem("Shipped") }TimelineItem¶
title, time:, description:, systemImage:, status:
role timelineitem · arguments title
Source
TimelineItem("Title")ToolbarItem¶
ToolbarItem(placement: .topBarTrailing) { … }
role toolbaritem
Source
ToolbarItem() { Text("Content"); Button("Action") }ToolbarItemGroup¶
role toolbaritem
Source
ToolbarItemGroup() { Text("Content"); Button("Action") }Tree¶
Tree { TreeItem("src") { TreeItem("main.swift") } }
role tree
Source
Tree() { TreeItem("Folder") { TreeItem("File") } }TreeItem¶
label, systemImage:, folder:, expanded:, selected:, detail:
role treeitem · arguments label
Source
TreeItem("Label")VStack¶
Vertical stack. spacing:, alignment: .leading|.center|.trailing
role vstack
Source
VStack() { Text("Content"); Button("Action") }VideoPlayer¶
poster image, progress: 0…1, time:, duration:, playing:
role media · arguments image
Source
VideoPlayer().frame(width: 160, height: 96)Whiteboard¶
role canvas · defaults grid: "dots"
Source
Whiteboard() { Text("Content"); Button("Action") }.frame(width: 160, height: 96)ZStack¶
Overlapping layers. alignment:
role zstack
Source
ZStack() { Text("Content"); Button("Action") }