Carbon¶
Imitates: IBM Carbon Design System v11 · @carbon/react, White theme (light) and g100 (dark); g10 / g90 zones via Theme 11 · Pack id: carbon · Selected by: pack="carbon", import Carbon, import CarbonReact · Default device: desktop (browser chrome)
148 own elements, plus 106 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(title:, open: true) { … } }
role vstack · defaults alignment: "stretch", spacing: 0
Source
Accordion() { Text("Content"); Button("Action") }AccordionItem¶
role accordion · arguments title
Source
AccordionItem("Title") { Text("Content"); Button("Action") }ActionableNotification¶
Inline notification with an action: ActionableNotification(…) actions: { Button("Undo", kind: "tertiary", size: "sm") }
role alert · arguments title · defaults closable: True, severity: "error"
Source
ActionableNotification("Title")Breadcrumb¶
Breadcrumb(["Home", "Projects", "Atlas"]) or BreadcrumbItem children
role breadcrumb · arguments items
Source
Breadcrumb(["One", "Two", "Three"])Button¶
Button("Create", kind: "secondary", size: "sm" | "md" | "lg" | "xl", renderIcon: "Add") — icon sits at the trailing edge
role button · arguments label · defaults variant: "primary" · variants primary, secondary, tertiary, ghost, danger, danger--tertiary, danger--ghost
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("tertiary"); Text("tertiary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("ghost"); Text("ghost").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("danger--tertiary"); Text("danger--tertiary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("danger--ghost"); Text("danger--ghost").font(.caption).foregroundStyle(.secondary) }
}ButtonSet¶
Buttons side by side with no gap (secondary + primary)
role toolbar · defaults variant: "set"
Source
ButtonSet() { Button("Save"); Button("Share") }Checkbox¶
Checkbox("Email me", checked: true) · checked: "mixed"
role checkbox · arguments label
Source
Checkbox("Label")CheckboxGroup¶
CheckboxGroup(legendText:) { Checkbox … }
role radiogroup · arguments label
Source
CheckboxGroup("Label")ClickableTile¶
Whole tile is a link (arrow at the bottom right)
role card · arguments title · defaults variant: "clickable"
Source
ClickableTile("Title") { Text("Content"); Button("Action") }CodeSnippet¶
CodeSnippet("npm install @carbon/react", type: "single") — copy button at the end
role code · arguments code · defaults lineNumbers: False · variants single, multi, inline
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { CodeSnippet("let total = items.count").variant("single"); Text("single").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { CodeSnippet("let total = items.count").variant("multi"); Text("multi").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { CodeSnippet("let total = items.count").variant("inline"); Text("inline").font(.caption).foregroundStyle(.secondary) }
}Column¶
Grid column: Column(lg: 8) spans 8 of 16 columns
role vstack · defaults alignment: "stretch"
Source
Column() { Text("Content"); Button("Action") }ComboButton¶
Primary action with a chevron menu
role menu · arguments label
Source
ComboButton("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }ComposedModal¶
ComposedModal(title:) { ModalBody { … } } actions: { Button(kind: "secondary"); Button }
role dialog · arguments title
Source
ComposedModal("Title") { Text("Content"); Button("Action") }Content¶
UI Shell main content area (32px padding)
role vstack · defaults alignment: "stretch"
Source
Content() { Text("Content"); Button("Action") }ContentSwitcher¶
ContentSwitcher(selectedIndex: 0) { Switch("All"); Switch("Active") } · size: "sm" | "lg"
role segmented · arguments items
Source
ContentSwitcher(["One", "Two", "Three"])CopyButton¶
role button · arguments icon · defaults icon: "doc.on.doc", iconOnly: True, variant: "ghost"
Source
CopyButton()DataTable¶
DataTable(columns: [..], rows: [[..]], selectable: true, selectedRows: [1], sortColumn: 0, size: "md") — or TableRow/TableExpandRow children
role table · variants zebra
| Name | Status |
|---|---|
| Ana Lima | Active |
| Ben Okafor | Away |
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { DataTable(columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]]).variant("zebra"); Text("zebra").font(.caption).foregroundStyle(.secondary) }
}DataTableSkeleton¶
role skeleton · defaults lines: 6
Source
DataTableSkeleton().frame(width: 160, height: 96)DatePicker¶
DatePicker("Start date", value: "2026-11-23")
role datepicker · arguments label · defaults format: "numeric", placeholder: "mm/dd/yyyy"
Source
DatePicker("Label")DatePickerInput¶
role datepicker · arguments label · defaults format: "numeric", placeholder: "mm/dd/yyyy"
Source
DatePickerInput("Label")DefinitionTooltip¶
role tooltip · arguments text
Source
DefinitionTooltip("Text") { Text("Content"); Button("Action") }DismissibleTag¶
role chip · arguments label · defaults color: "gray", removable: True
Source
DismissibleTag("Label")Dropdown¶
Dropdown("Plan", items: ["Lite", "Standard"], selectedItem: "Standard", open: true)
role select · arguments label
Source
Dropdown("Label")ExpandableSearch¶
role textfield · arguments placeholder · defaults kind: "search"
Source
ExpandableSearch("Placeholder")ExpandableTile¶
Chevron at the bottom right; include TileBelowTheFoldContent to show it expanded
role card · arguments title · defaults variant: "expandable"
Source
ExpandableTile("Title") { Text("Content"); Button("Action") }FileUploader¶
FileUploader(labelTitle: "Upload files", labelDescription: "Max 500 kB") { FileUploaderButton("Add file"); FileUploaderItem("a.png", status: "complete") }
role card · arguments title
Source
FileUploader("Title") { Text("Content"); Button("Action") }FileUploaderButton¶
role button · arguments label · defaults size: "sm", variant: "primary"
Source
FileUploaderButton("Label")FileUploaderDropContainer¶
Dashed drop area: FileUploaderDropContainer("Drag and drop files here or click to upload")
role dropzone · arguments label
Source
FileUploaderDropContainer("Label")FileUploaderItem¶
Uploaded file row: FileUploaderItem("report.pdf", status: "complete")
role chip · arguments label · defaults removable: True, variant: "edit" · variants edit, uploading, complete
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { FileUploaderItem("Label").variant("edit"); Text("edit").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { FileUploaderItem("Label").variant("uploading"); Text("uploading").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { FileUploaderItem("Label").variant("complete"); Text("complete").font(.caption).foregroundStyle(.secondary) }
}FlexGrid¶
role vstack · defaults alignment: "stretch"
Source
FlexGrid() { Text("Content"); Button("Action") }Form¶
Form { TextInput … } · fields stack with 24px gaps
role form
Source
Form() { TextField("Name"); Toggle("Notifications", isOn: true) }FormGroup¶
FormGroup(legendText: "Contact") { … }
role section · arguments title
Source
FormGroup("Title") { Text("First item"); Text("Second item") }FormItem¶
role vstack · defaults alignment: "stretch"
Source
FormItem() { Text("Content"); Button("Action") }FormLabel¶
12px label-01 field label
role text · arguments content
Source
FormLabel("Content")Grid¶
16-column CSS Grid: Grid { Column(lg: 4) { … } } · .narrow() / .condensed()
role grid · arguments columns · variants wide, narrow, condensed
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Grid(["Name", "Status"]) { Text("Content"); Button("Action") }.variant("wide"); Text("wide").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Grid(["Name", "Status"]) { Text("Content"); Button("Action") }.variant("narrow"); Text("narrow").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Grid(["Name", "Status"]) { Text("Content"); Button("Action") }.variant("condensed"); Text("condensed").font(.caption).foregroundStyle(.secondary) }
}GroupedBarChart¶
GroupedBarChart(series: [[..], [..]], seriesNames:, labels:)
role chart · defaults kind: "bar"
Source
GroupedBarChart(values: [3, 5, 2, 6, 4])Header¶
UI Shell header (48px, g100): Header("Cloud Console", prefix: "Acme", menu: true) { HeaderGlobalAction("Notification") } center: { HeaderNavigation { … } }
role appbar · arguments subtitle
Source
Header("Subtitle") { Text("Content"); Button("Action") }HeaderGlobalAction¶
48×48 header icon button: HeaderGlobalAction("Notification").badge(true)
role button · arguments icon · defaults iconOnly: True
Source
HeaderGlobalAction("star")HeaderGlobalBar¶
Right-hand group of HeaderGlobalAction icons
role toolbar
Source
HeaderGlobalBar() { Button("Save"); Button("Share") }HeaderMenu¶
HeaderMenu("Manage", open: true) { HeaderMenuItem … }
role menu · arguments label
Source
HeaderMenu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }HeaderMenuButton¶
role button · arguments icon · defaults icon: "line.3.horizontal", iconOnly: True
Source
HeaderMenuButton()HeaderMenuItem¶
Header link; .selected() / isCurrentPage: true marks the current page
role button · arguments label
Source
HeaderMenuItem("Label")HeaderName¶
Header product name (or use Header(prefix:))
role text · arguments content
Source
HeaderName("Content")HeaderNavigation¶
HeaderNavigation { HeaderMenuItem("Catalog").selected() … }
role toolbar
Source
HeaderNavigation() { Button("Save"); Button("Share") }HeaderPanel¶
Right-hand panel under the header (e.g. Switcher)
role sidebar · arguments title · defaults variant: "panel"
Source
HeaderPanel("Title") { Text("Content"); Button("Action") }Heading¶
Heading("Deployments") — heading-03 (20px); font: "heading-05" etc. for other productive headings
role text · arguments content · defaults font: "heading03"
Source
Heading("Content")HelperText¶
12px helper text under a control
role text · arguments content
Source
HelperText("Content")HistogramChart¶
role chart · defaults kind: "histogram"
Source
HistogramChart(values: [3, 5, 2, 6, 4])IconButton¶
IconButton("Edit", kind: "ghost", size: "sm")
role button · arguments icon · defaults iconOnly: True, variant: "primary" · variants primary, secondary, tertiary, ghost
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { IconButton("star").variant("primary"); Text("primary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { IconButton("star").variant("secondary"); Text("secondary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { IconButton("star").variant("tertiary"); Text("tertiary").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { IconButton("star").variant("ghost"); Text("ghost").font(.caption).foregroundStyle(.secondary) }
}InlineLoading¶
role progress · arguments label · defaults kind: "circular", size: "small"
Source
InlineLoading("Label")InlineNotification¶
InlineNotification(title: "Error", subtitle: "…", kind: "error" | "success" | "warning" | "info", lowContrast: true)
role alert · arguments title · defaults closable: True, severity: "error" · variants lowContrast
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { InlineNotification("Title").variant("lowContrast"); Text("lowContrast").font(.caption).foregroundStyle(.secondary) }
}Layer¶
Raises nested components one layer (layer-02 / field-02)
role vstack · defaults alignment: "stretch"
Source
Layer() { Text("Content"); Button("Action") }Link¶
Link("Learn more", icon: "ArrowRight") · size: "sm" | "lg"
role link · arguments label, href
Source
Link("Label", "#")MenuButton¶
MenuButton("Actions", kind: "primary", open: true) { MenuItem … }
role menu · arguments label
Source
MenuButton("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }MeterChart¶
Carbon Charts meter: a labelled proportion bar
role progress · arguments label
Source
MeterChart("Label")Modal¶
Modal("Delete project?", buttons: ["Cancel", "Delete"], destructive: "Delete", closable: true) { body }
role dialog · arguments title
Source
Modal("Title") { Text("Content"); Button("Action") }ModalBody¶
role vstack · defaults alignment: "stretch"
Source
ModalBody() { Text("Content"); Button("Action") }MultiSelect¶
MultiSelect("Tags", selectedItems: ["api", "web"]) — selected values show as tags
role select · arguments label
Source
MultiSelect("Label")NumberInput¶
NumberInput("Replicas", value: 3) — field with − / + buttons
role stepper · arguments label
Source
NumberInput("Label")OperationalTag¶
role chip · arguments label · defaults color: "gray"
Source
OperationalTag("Label")OrderedList¶
OrderedList { ListItem("…") } — numbered
role list
Source
OrderedList() { Text("First item"); Text("Second item") }OverflowMenu¶
OverflowMenu(open: true) { OverflowMenuItem("Edit"); OverflowMenuItem("Delete", isDelete: true) }
role menu · defaults icon: "ellipsis.vertical"
Source
OverflowMenu() { Button("Open"); Button("Save"); Divider(); Button("Close") }Pagination¶
Carbon's bar: Pagination("31–40 of 97 items", page: 4, count: 10, pageSize: 10)
role pagination · arguments summary · defaults rowsPerPage: 10
Source
Pagination("Summary")PaginationNav¶
Numbered page links: PaginationNav(page: 3, totalItems: 12)
role pagination
Source
PaginationNav()PasswordInput¶
role textfield · arguments label · defaults kind: "password", trailingIcon: "eye"
Source
PasswordInput("Label")ProgressBar¶
ProgressBar("Uploading", value: 60, showValue: true) · size: "small"
role progress · arguments label
Source
ProgressBar("Label")ProgressIndicator¶
ProgressIndicator(currentIndex: 1) { ProgressStep("Details") … } · errors: [2]
role steps · arguments steps
Source
ProgressIndicator(["Cart", "Shipping", "Payment"])ProgressStep¶
Step of a ProgressIndicator: ProgressStep("Details", secondaryLabel: "Optional")
role text · arguments label
Source
ProgressStep("Label")RadioButtonGroup¶
RadioButtonGroup(legendText: "Plan", options: [..], valueSelected: "Lite", orientation: .vertical)
role radiogroup · arguments label
Source
RadioButtonGroup("Label")RadioTile¶
Radio at the top right; .selected()
role card · arguments title · defaults variant: "radio"
Source
RadioTile("Title") { Text("Content"); Button("Action") }Search¶
Search("Search", size: "lg") · value: shows the clear button
role textfield · arguments placeholder · defaults kind: "search"
Source
Search("Placeholder")Select¶
Select("Region", value: "US South") { SelectItem("US South") … }
role select · arguments label
Source
Select("Label")SelectItem¶
Option of a Select: SelectItem("US South")
role text · arguments text
Source
SelectItem("Text")SelectableTag¶
SelectableTag("Python").selected()
role chip · arguments label
Source
SelectableTag("Label")SelectableTile¶
Checkbox at the top right; .selected() outlines it
role card · arguments title · defaults variant: "selectable"
Source
SelectableTile("Title") { Text("Content"); Button("Action") }SideNav¶
SideNav { SideNavLink("Dashboard", icon: "Dashboard").selected(); SideNavMenu("Manage") { SideNavMenuItem … } }
role sidebar · arguments title · variants fixed, rail
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { SideNav("Title") { Text("Content"); Button("Action") }.variant("fixed"); Text("fixed").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { SideNav("Title") { Text("Content"); Button("Action") }.variant("rail"); Text("rail").font(.caption).foregroundStyle(.secondary) }
}SideNavMenu¶
Expandable SideNav category; expands when a child is selected or expanded: true
role navitem · arguments label
Source
SideNavMenu("Label")SimpleBarChart¶
Carbon Charts: SimpleBarChart(values: [..], labels: [..])
role chart · defaults kind: "bar"
Source
SimpleBarChart(values: [3, 5, 2, 6, 4])SkeletonPlaceholder¶
role skeleton · defaults lines: 0, shape: "rectangle"
Source
SkeletonPlaceholder().frame(width: 160, height: 96)Slider¶
Slider(labelText: "Budget", value: 40, min: 0, max: 100, minLabel: "0", maxLabel: "100")
role slider · defaults showValue: True
Source
Slider()Stack¶
Stack(gap: 16) · orientation: .horizontal for a row
role vstack · defaults alignment: "stretch"
Source
Stack() { Text("Content"); Button("Action") }StackedAreaChart¶
role chart · defaults kind: "area", stacked: True
Source
StackedAreaChart(values: [3, 5, 2, 6, 4])StackedBarChart¶
role chart · defaults kind: "bar", stacked: True
Source
StackedBarChart(values: [3, 5, 2, 6, 4])StructuredList¶
StructuredList(columns: [..]) { StructuredListRow { StructuredListCell("…") } } · selection: true for radio rows
role table · arguments columns
| Name | Status |
|---|---|
| Ana Lima | Active |
| Ben Okafor | Away |
Source
StructuredList(["Name", "Status"], columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])StructuredListCell¶
Cell of a StructuredListRow; head: true for a header cell
role text · arguments content
Source
StructuredListCell("Content")StructuredListWrapper¶
role table · arguments columns
| Name | Status |
|---|---|
| Ana Lima | Active |
| Ben Okafor | Away |
Source
StructuredListWrapper(["Name", "Status"], columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])Switch¶
Segment of a ContentSwitcher: Switch("Active")
role text · arguments text
Source
Switch("Text")TabList¶
role tabs · arguments items · defaults placement: "top"
Source
TabList(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }TabPanel¶
role vstack · defaults alignment: "stretch"
Source
TabPanel() { Text("Content"); Button("Action") }Table¶
role table
| Name | Status |
|---|---|
| Ana Lima | Active |
| Ben Okafor | Away |
Source
Table(columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])TableBatchActions¶
Blue batch bar shown when rows are selected: TableBatchActions("3 items selected") { TableBatchAction("Delete", renderIcon: "TrashCan"); Button("Cancel") }
role toolbar · arguments title
Source
TableBatchActions("Title") { Button("Save"); Button("Share") }TableCell¶
Cell inside TableRow / StructuredListRow
role text · arguments content
Source
TableCell("Content")TableContainer¶
TableContainer(title: "Deployments", description: "…") { TableToolbar { … }; DataTable(…) }
role card · arguments title
Source
TableContainer("Title") { Text("Content"); Button("Action") }TableExpandRow¶
Row with an expand chevron; follow it with TableExpandedRow { … } to show it expanded
role tablerow · defaults status: "collapsed"
Source
TableExpandRow()TableExpandedRow¶
Full-width detail row under a TableExpandRow
role tablerow · defaults status: "detail"
Source
TableExpandedRow()TableToolbar¶
48px toolbar above a DataTable: search, icon actions, primary button
role toolbar
Source
TableToolbar() { Button("Save"); Button("Share") }TableToolbarContent¶
role hstack · defaults spacing: 0
Source
TableToolbarContent() { Text("Content"); Button("Action") }TableToolbarMenu¶
role menu · defaults icon: "gear"
Source
TableToolbarMenu() { Button("Open"); Button("Save"); Divider(); Button("Close") }TableToolbarSearch¶
role textfield · arguments placeholder · defaults kind: "search", placeholder: "Search"
Source
TableToolbarSearch()Tabs¶
Tabs(selectedIndex: 0) { Tab("Overview") { panel } … } · .contained()
role tabs · arguments items · defaults placement: "top" · variants line, contained
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Tabs(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("line"); Text("line").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Tabs(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }.variant("contained"); Text("contained").font(.caption).foregroundStyle(.secondary) }
}Tag¶
Tag("Running", type: "green") — red, magenta, purple, blue, cyan, teal, green, gray, cool-gray, warm-gray, high-contrast, outline · size: "sm"
role chip · arguments label · defaults color: "gray"
Source
Tag("Label")TextArea¶
TextArea("Notes", value:, rows: 4)
role textfield · arguments label · defaults kind: "multiline"
Source
TextArea("Label")TextInput¶
TextInput("Email", placeholder:, helperText:, invalidText: "…", size: "sm" | "md" | "lg")
role textfield · arguments label
Source
TextInput("Label")Theme¶
Zoned theme: Theme("g100") { … } renders its content in that theme
role vstack · arguments variant · defaults alignment: "stretch" · variants white, g10, g90, g100
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Theme() { Text("Content"); Button("Action") }.variant("white"); Text("white").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Theme() { Text("Content"); Button("Action") }.variant("g10"); Text("g10").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Theme() { Text("Content"); Button("Action") }.variant("g90"); Text("g90").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Theme() { Text("Content"); Button("Action") }.variant("g100"); Text("g100").font(.caption).foregroundStyle(.secondary) }
}Tile¶
Tile(title:) { … } — layer-01 surface, 16px padding, square
role card · arguments title
Source
Tile("Title") { Text("Content"); Button("Action") }TileAboveTheFoldContent¶
role vstack · defaults alignment: "stretch"
Source
TileAboveTheFoldContent() { Text("Content"); Button("Action") }TileBelowTheFoldContent¶
Present = ExpandableTile shown expanded
role vstack · defaults alignment: "stretch"
Source
TileBelowTheFoldContent() { Text("Content"); Button("Action") }TileGroup¶
Group of RadioTiles
role vstack · defaults alignment: "stretch"
Source
TileGroup() { Text("Content"); Button("Action") }TimePicker¶
role datepicker · arguments label · defaults kind: "time", placeholder: "hh:mm"
Source
TimePicker("Label")ToastNotification¶
ToastNotification(title:, subtitle:, kind:) { Text("caption") } — top-right; inline: true to place it
role toast · arguments title · defaults closable: True, position: "topTrailing", severity: "error"
Source
ToastNotification("Title")Toggle¶
Toggle("Notifications", toggled: true, size: "sm")
role toggle · arguments label · defaults offText: "Off", onText: "On"
Source
Toggle("Label")Toggletip¶
role tooltip · arguments text
Source
Toggletip("Text") { Text("Content"); Button("Action") }Tooltip¶
Tooltip("Copy") { IconButton … } · align: .bottom
role tooltip · arguments text
Source
Tooltip("Text") { Text("Content"); Button("Action") }TreeView¶
role tree · arguments label
Source
TreeView("Label") { TreeItem("Folder") { TreeItem("File") } }UnorderedList¶
UnorderedList { ListItem("…") } — en-dash bullets
role list
Source
UnorderedList() { Text("First item"); Text("Second item") }Core vocabulary in this style¶
Alert¶
role dialog · arguments title · defaults variant: "alert"
Source
Alert("Title") { Text("Content"); Button("Action") }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)Card¶
role card · arguments title
Source
Card("Title") { Text("Content"); Button("Action") }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") }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)])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") }Image¶
Image("path.png") or Image(systemName: "star")
role image · arguments name
Source
Image().frame(width: 160, height: 96)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")Placeholder¶
A labelled box for maps, charts, media
role placeholder · arguments label
Source
Placeholder("Label").frame(width: 160, height: 96)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)Row¶
title, subtitle:, detail:, systemImage:, chevron:
role listitem · arguments title
Source
Row("Title")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") }