GTK 4 · libadwaita¶
Imitates: GTK 4 with libadwaita and the Adwaita stylesheet (GNOME 48/49) GTK 4.18 · libadwaita 1.7/1.8 · Pack id: gtk · Selected by: pack="gtk", import Gtk, import Adwaita, import Libadwaita, import GNOME · Default device: desktop (gnome chrome)
107 own elements, plus 122 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¶
AboutDialog¶
AboutDialog(applicationName:, developerName:, applicationIcon:) { rows }
role dialog · arguments title · defaults variant: "about"
Source
AboutDialog("Title") { Text("Content"); Button("Action") }ActionBar¶
ActionBar { start … Spacer() … end } — bottom bar
role toolbar · defaults variant: "actionbar"
Source
ActionBar() { Button("Save"); Button("Share") }ActionRow¶
ActionRow("Title", subtitle:, icon:, chevron: true) { suffix widgets }
role listitem · arguments title
Source
ActionRow("Title")AlertDialog¶
AlertDialog("Delete Notes?", body:, responses: ["Cancel", "Delete"], defaultResponse: "Delete", destructive: "Delete")
role dialog · arguments title · defaults variant: "alert"
Source
AlertDialog("Title") { Text("Content"); Button("Action") }ApplicationWindow¶
Adw.ApplicationWindow — the window content; put a ToolbarView or a split view inside
role vstack · defaults alignment: "stretch", spacing: 0
Source
ApplicationWindow() { Text("Content"); Button("Action") }Avatar¶
Avatar("Ana Lima", size: .large, image:) — Adwaita gradient colours
role avatar · arguments name
Source
Avatar("Ana Lima")Banner¶
Banner("Title", actions: { Button("Restart") }) — the strip under a HeaderBar
role alert · arguments title · defaults showIcon: False
Source
Banner("Title")BottomSheet¶
Adw.BottomSheet (1.6)
role dialog · arguments title · defaults variant: "sheet"
Source
BottomSheet("Title") { Text("Content"); Button("Action") }Box¶
Box(orientation: .horizontal, spacing: 6) { … } · .variant(.linked) joins buttons
role vstack · defaults alignment: "stretch" · variants linked, toolbar
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Box() { Text("Content"); Button("Action") }.variant("linked"); Text("linked").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Box() { Text("Content"); Button("Action") }.variant("toolbar"); Text("toolbar").font(.caption).foregroundStyle(.secondary) }
}BoxedList¶
ListBox styled .boxed-list — rows in a rounded card
role list · defaults variant: "boxedList"
Source
BoxedList() { Text("First item"); Text("Second item") }Button¶
Button("Save", icon:) · .variant(.suggested | .destructive | .flat | .pill | .circular | .osd)
role button · arguments label · variants suggested, destructive, flat, raised, pill, circular, osd, opaque, linked
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("suggested"); Text("suggested").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("destructive"); Text("destructive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("flat"); Text("flat").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("raised"); Text("raised").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("pill"); Text("pill").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("circular"); Text("circular").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("osd"); Text("osd").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("opaque"); Text("opaque").font(.caption).foregroundStyle(.secondary) }
}ButtonRow¶
ButtonRow("Add Account", icon:) · .variant(.suggested | .destructive) — 1.6
role listitem · arguments title · variants suggested, destructive
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ButtonRow("Title").variant("suggested"); Text("suggested").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ButtonRow("Title").variant("destructive"); Text("destructive").font(.caption).foregroundStyle(.secondary) }
}Calendar¶
Calendar(selection: "2026-11-24", marked: […])
role calendar
Source
Calendar()Carousel¶
Carousel { pages } — horizontal pages
role scroll · defaults axes: "horizontal"
Source
Carousel() { Text("Content"); Button("Action") }CarouselIndicatorDots¶
CarouselIndicatorDots(pages: 4, position: 2)
role pagination · defaults variant: "dots"
Source
CarouselIndicatorDots()CarouselIndicatorLines¶
role pagination · defaults variant: "lines"
Source
CarouselIndicatorLines()CenterBox¶
start / center / end widgets in a row
role hstack
Source
CenterBox() { Text("Content"); Button("Action") }CheckButton¶
CheckButton("Label", active: true)
role checkbox · arguments label · variants selectionMode
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { CheckButton("Label").variant("selectionMode"); Text("selectionMode").font(.caption).foregroundStyle(.secondary) }
}Clamp¶
Clamp { … } — limits its child to 600 px (maximumSize:) and centres it
role vstack · defaults alignment: "stretch"
Source
Clamp() { Text("Content"); Button("Action") }ClampScrollable¶
role vstack · defaults alignment: "stretch"
Source
ClampScrollable() { Text("Content"); Button("Action") }ColumnView¶
ColumnView(columns: ["Name", "Size"], rows: [[…]]) — Gtk.ColumnView data table
role table
| Name | Status |
|---|---|
| Ana Lima | Active |
| Ben Okafor | Away |
Source
ColumnView(columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])ComboRow¶
ComboRow("Title", subtitle:, selected: "Current value")
role listitem · arguments title · defaults chevron: True
Source
ComboRow("Title")Dialog¶
Adw.Dialog("Title") { ToolbarView … }
role dialog · arguments title
Source
Dialog("Title") { Text("Content"); Button("Action") }DropDown¶
DropDown(model: ["A", "B"], selected: "A", open:)
role select · arguments label
Source
DropDown("Label")Entry¶
Entry("Placeholder", text:, icon:) · .state(.focused | .error)
role textfield · arguments placeholder
Source
Entry("Placeholder")EntryRow¶
EntryRow("Title", text:) — the title floats above the text
role textfield · arguments title
Source
EntryRow("Title")ExpanderRow¶
ExpanderRow("Title", subtitle:, expanded: true) { nested rows }
role accordion · arguments title
Source
ExpanderRow("Title") { Text("Content"); Button("Action") }FlowBox¶
FlowBox(columns: 5) { FlowBoxChild … }
role grid · defaults columns: 4
Source
FlowBox() { Text("Content"); Button("Action") }FontDialogButton¶
role button · arguments label · defaults variant: "font"
Source
FontDialogButton("Label")Frame¶
Gtk.Frame — a bordered box
role card · arguments title
Source
Frame("Title") { Text("Content"); Button("Action") }GridView¶
GridView(columns: 6) { … } — Nautilus-style icon grid
role grid · defaults columns: 5
Source
GridView() { Text("Content"); Button("Action") }HeaderBar¶
HeaderBar("Title", subtitle:, start: { … }, titleWidget: { ViewSwitcher }) { end widgets } — draws the window close button; showEndTitleButtons: false for inner panes
role appbar · arguments title · defaults kind: "window" · variants flat, raised
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { HeaderBar("Title") { Text("Content"); Button("Action") }.variant("flat"); Text("flat").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { HeaderBar("Title") { Text("Content"); Button("Action") }.variant("raised"); Text("raised").font(.caption).foregroundStyle(.secondary) }
}InlineViewSwitcher¶
Adw.InlineViewSwitcher (1.7) — items:, selection:
role segmented · arguments items
Source
InlineViewSwitcher(["One", "Two", "Three"])Label¶
Label("Text", style: .title1 | .title2 | .title3 | .title4 | .heading | .caption | .captionHeading | .largeTitle) · .class("dim-label")
role text · arguments content
Source
Label("Content")LevelBar¶
LevelBar(value: 0.7) · .color(.warning | .error | .success) for the low/high offsets
role progress · arguments label · defaults variant: "levelbar"
Source
LevelBar("Label")LinkButton¶
LinkButton("Website", uri:)
role link · arguments label, destination
Source
LinkButton("Label")ListBox¶
ListBox { rows } · .variant(.boxedList | .navigationSidebar | .richList)
role list · variants boxedList, boxedListSeparate, navigationSidebar, richList, plain
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ListBox() { Text("First item"); Text("Second item") }.variant("boxedList"); Text("boxedList").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListBox() { Text("First item"); Text("Second item") }.variant("boxedListSeparate"); Text("boxedListSeparate").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListBox() { Text("First item"); Text("Second item") }.variant("navigationSidebar"); Text("navigationSidebar").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListBox() { Text("First item"); Text("Second item") }.variant("richList"); Text("richList").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListBox() { Text("First item"); Text("Second item") }.variant("plain"); Text("plain").font(.caption).foregroundStyle(.secondary) }
}ListView¶
role list · variants richList, navigationSidebar, plain
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ListView() { Text("First item"); Text("Second item") }.variant("richList"); Text("richList").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListView() { Text("First item"); Text("Second item") }.variant("navigationSidebar"); Text("navigationSidebar").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ListView() { Text("First item"); Text("Second item") }.variant("plain"); Text("plain").font(.caption).foregroundStyle(.secondary) }
}MenuButton¶
MenuButton(icon: "open-menu", open: true) { MenuItem … }
role menu · arguments label · variants flat, suggested, circular
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { MenuButton("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }.variant("flat"); Text("flat").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MenuButton("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }.variant("suggested"); Text("suggested").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MenuButton("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }.variant("circular"); Text("circular").font(.caption).foregroundStyle(.secondary) }
}MenuItem¶
MenuItem("Preferences", shortcut: "Ctrl+,", checked:)
role menuitem · arguments label
Source
MenuItem("Label")MessageDialog¶
role dialog · arguments title · defaults variant: "alert"
Source
MessageDialog("Title") { Text("Content"); Button("Action") }NavigationPage¶
NavigationPage("Title") { ToolbarView { … } }
role vstack · arguments title · defaults alignment: "stretch", spacing: 0
Source
NavigationPage("Title") { Text("Content"); Button("Action") }NavigationSidebar¶
ListBox.navigation-sidebar — NavigationSidebar(selection:) { SidebarItem("Wi-Fi", icon:) … }
role sidebar · arguments title
Source
NavigationSidebar("Title") { Text("Content"); Button("Action") }NavigationSplitView¶
NavigationSplitView { sidebar page } content: { content page }
role split
Source
NavigationSplitView() { Text("Content"); Button("Action") }NavigationView¶
Navigation stack — shows its (top) page
role vstack · defaults alignment: "stretch", spacing: 0
Source
NavigationView() { Text("Content"); Button("Action") }OverlaySplitView¶
OverlaySplitView { sidebar } content: { … }
role split
Source
OverlaySplitView() { Text("Content"); Button("Action") }Paned¶
Paned { start } content: { end }
role split
Source
Paned() { Text("Content"); Button("Action") }PasswordEntry¶
role textfield · arguments placeholder · defaults kind: "password", reveal: True
Source
PasswordEntry("Placeholder")PasswordEntryRow¶
PasswordEntryRow("Password", text:)
role textfield · arguments title · defaults kind: "password", reveal: True
Source
PasswordEntryRow("Title")PathBar¶
Nautilus path bar: PathBar(["Home", "Projects"])
role breadcrumb · arguments items
Source
PathBar(["One", "Two", "Three"])Popover¶
A popover surface; place it with .overlay(alignment:)
role card · arguments title · defaults variant: "popover"
Source
Popover("Title") { Text("Content"); Button("Action") }PopoverMenu¶
PopoverMenu { MenuItem … } — an open menu popover
role menu · arguments label
Source
PopoverMenu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }PreferencesDialog¶
PreferencesDialog("Preferences") { PreferencesPage … }
role dialog · arguments title · defaults variant: "preferences"
Source
PreferencesDialog("Title") { Text("Content"); Button("Action") }PreferencesGroup¶
PreferencesGroup("Title", description:) { rows } headerSuffix: { Button }
role section · arguments title
Source
PreferencesGroup("Title") { Text("First item"); Text("Second item") }PreferencesPage¶
PreferencesPage { PreferencesGroup … } — clamped, scrolling page of groups
role form · arguments title
Source
PreferencesPage("Title") { TextField("Name"); Toggle("Notifications", isOn: true) }PreferencesWindow¶
Preferences window (deprecated; use PreferencesDialog)
role vstack · defaults alignment: "stretch", spacing: 0
Source
PreferencesWindow() { Text("Content"); Button("Action") }ProgressBar¶
ProgressBar(fraction: 0.6, showText:) — none = pulsing
role progress · arguments label · variants osd
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ProgressBar("Label").variant("osd"); Text("osd").font(.caption).foregroundStyle(.secondary) }
}RadioButton¶
CheckButton in a group — RadioButton("Label", active: true)
role radio · arguments label
Source
RadioButton("Label")ScrolledWindow¶
Scrolling region (static)
role scroll · arguments axes
Source
ScrolledWindow() { Text("Content"); Button("Action") }SearchBar¶
SearchBar { SearchEntry(…) } — revealed under the HeaderBar
role toolbar · defaults variant: "searchbar"
Source
SearchBar() { Button("Save"); Button("Share") }SearchEntry¶
SearchEntry("Search", text:)
role textfield · arguments placeholder · defaults kind: "search"
Source
SearchEntry("Placeholder")ShortcutLabel¶
ShortcutLabel(["Ctrl", "S"])
role kbd · arguments keys
Source
ShortcutLabel(["⌘", "K"])SidebarItem¶
SidebarItem("Wi-Fi", icon: "network-wireless", badge:) · .selected()
role navitem · arguments label
Source
SidebarItem("Label")SourceView¶
GtkSourceView 5 — SourceView("…", language: "python", lineNumbers:, highlight:)
role code · arguments code
Source
SourceView("let total = items.count")SplitButton¶
SplitButton("Open") — button + dropdown arrow
role button · arguments label · defaults split: True
Source
SplitButton("Label")Stack¶
Stack(selection:) { StackPage("Name") { … } } — shows the selected page
role tabs · defaults variant: "stack"
Source
Stack() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }StackSwitcher¶
StackSwitcher(items: ["A", "B"], selection: "A") — linked buttons
role segmented · arguments items
Source
StackSwitcher(["One", "Two", "Three"])StatusPage¶
StatusPage("No Results", icon: "system-search", description:) { Button(…).variant(.pill) }
role emptystate · arguments title
Source
StatusPage("Title")Statusbar¶
role toolbar · defaults variant: "statusbar"
Source
Statusbar() { Button("Save"); Button("Share") }SwitchRow¶
SwitchRow("Title", subtitle:, active: true)
role toggle · arguments title
Source
SwitchRow("Title")TabBar¶
TabBar(items: ["a.txt", "b.txt"], selection:)
role tabs · arguments items · defaults placement: "top", variant: "tabview"
Source
TabBar(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }TabView¶
TabView(selection:) { TabPage("notes.md") { … } } — Adw tab bar + pages
role tabs · defaults placement: "top", variant: "tabview"
Source
TabView() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }TextView¶
TextView(text:, rows:) — multi-line text area
role textfield · arguments text · defaults kind: "multiline"
Source
TextView("Text")Toast¶
Toast("‘Report.pdf’ moved to trash", buttonLabel: "Undo") — floats at the bottom
role toast · arguments title
Source
Toast("Title")ToastOverlay¶
Hosts toasts; put the content and a Toast inside
role group
Source
ToastOverlay() { Text("Content"); Button("Action") }ToggleButton¶
ToggleButton("Bold", active: true)
role button · arguments label
Source
ToggleButton("Label")ToggleGroup¶
Adw.ToggleGroup (1.7) — items:, selection:
role segmented · arguments items · variants flat, round
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ToggleGroup(["One", "Two", "Three"]).variant("flat"); Text("flat").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ToggleGroup(["One", "Two", "Three"]).variant("round"); Text("round").font(.caption).foregroundStyle(.secondary) }
}ToolbarView¶
ToolbarView { HeaderBar(…); content; bottom bar } — content between the bars fills the space
role vstack · defaults alignment: "stretch", spacing: 0 · variants flat, raised, raisedBorder
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ToolbarView() { Text("Content"); Button("Action") }.variant("flat"); Text("flat").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ToolbarView() { Text("Content"); Button("Action") }.variant("raised"); Text("raised").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ToolbarView() { Text("Content"); Button("Action") }.variant("raisedBorder"); Text("raisedBorder").font(.caption).foregroundStyle(.secondary) }
}ViewStack¶
ViewStack(selection:) { ViewStackPage("Albums", icon:) { … } } — the selected page only
role tabs · defaults variant: "stack"
Source
ViewStack() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }ViewStackPage¶
ViewStackPage("Albums", icon: "photo", badge: 3) { … }
role tab · arguments title
Source
ViewStackPage("Title")ViewSwitcher¶
ViewSwitcher(selection:) { ViewSwitcherItem("World", icon:) … } — wide switcher for a HeaderBar titleWidget
role tabs · defaults placement: "top", variant: "switcher"
Source
ViewSwitcher() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }ViewSwitcherBar¶
ViewSwitcherBar(selection:) { ViewSwitcherItem … } — the narrow/mobile bottom bar
role tabs · defaults placement: "bottom", variant: "switcherBar"
Source
ViewSwitcherBar() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }Window¶
Adw.Window / Gtk.Window
role vstack · defaults alignment: "stretch", spacing: 0
Source
Window() { Text("Content"); Button("Action") }WindowTitle¶
WindowTitle("Document", "~/Notes") — title + subtitle for a HeaderBar titleWidget
role listitem · arguments title, subtitle
Source
WindowTitle("Title", "Subtitle")WrapBox¶
Adw.WrapBox (1.7) — wraps children onto lines
role hstack · defaults spacing: 6, wrap: True
Source
WrapBox() { Text("Content"); Button("Action") }Core vocabulary in this style¶
Accordion¶
role accordion · arguments title
Source
Accordion("Title") { Text("Content"); Button("Action") }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") }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") }DatePicker¶
selection: "2026-11-23"; .datePickerStyle(.graphical)
role datepicker · arguments label
Source
DatePicker("Label")DisclosureGroup¶
role accordion · arguments title
Source
DisclosureGroup("Title") { Text("Content"); Button("Action") }EmptyState¶
title, systemImage:, description: { actions }
role emptystate · arguments title
Source
EmptyState("Title")Form¶
role form
Source
Form() { TextField("Name"); Toggle("Notifications", isOn: true) }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") }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")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")Table¶
columns: ["Name", …], rows: [[…], …] or TableRow children
role table
| Name | Status |
|---|---|
| Ana Lima | Active |
| Ben Okafor | Away |
Source
Table(columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])Tabs¶
role tabs · arguments items · defaults placement: "top"
Source
Tabs(["One", "Two", "Three"]) { 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") }Tooltip¶
role tooltip · arguments text
Source
Tooltip("Text") { 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") }