Windows 3.1¶
Imitates: Windows 3.1 / Windows for Workgroups 3.11 (Win16, Windows Default colour scheme) 3.11 · Pack id: win31 · Selected by: pack="win31", import Windows31, import Win31, import Win16 · Default device: desktop (win31 chrome)
85 own elements, plus 127 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¶
ApplicationWindow¶
Same as Window
role card · arguments title · defaults kind: "window", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ApplicationWindow("Title") { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ApplicationWindow("Title") { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ApplicationWindow("Title") { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ApplicationWindow("Title") { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}Button¶
PUSHBUTTON; .variant(.default) is the DEFPUSHBUTTON with the heavy outline; .state(.focused) draws the dotted focus rectangle
role button · arguments label · defaults variant: "push" · variants push, default
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("push"); Text("push").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Button("Label").variant("default"); Text("default").font(.caption).foregroundStyle(.secondary) }
}CTEXT¶
Centred static text
role text · arguments content · defaults kind: "ctext"
Source
CTEXT("Content")CalcKey¶
A Calculator key; .foregroundStyle(.red) for C/CE like the original
role button · arguments label · defaults variant: "calc"
Source
CalcKey("Label")Calculator¶
Calculator window: an Edit display and a grid of CalcKeys
role card · arguments title · defaults kind: "window", title: "Calculator", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Calculator() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Calculator() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Calculator() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Calculator() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}CardStack¶
Overlapping IndexCards, back to front; offset each with .offset(x:y:)
role zstack · defaults alignment: "topLeading", kind: "cards"
Source
CardStack() { Text("Content"); Button("Action") }Cardfile¶
Cardfile window: MenuBar, a status Static, then a CardStack of IndexCards
role card · arguments title · defaults kind: "window", title: "Cardfile - (Untitled)", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Cardfile() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Cardfile() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Cardfile() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Cardfile() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}CheckBox¶
CheckBox("Wrap", checked: true) — square box with an X
role checkbox · arguments label
Source
CheckBox("Label")Clock¶
Clock window: ClockFace inside
role card · arguments title · defaults kind: "window", title: "Clock", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Clock() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Clock() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Clock() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Clock() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}ClockFace¶
Analog clock face at 10:10 (size with .frame)
role shape · defaults kind: "clock", shape: "circle" · variants analog, digital
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ClockFace().variant("analog").frame(width: 160, height: 96); Text("analog").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ClockFace().variant("digital").frame(width: 160, height: 96); Text("digital").font(.caption).foregroundStyle(.secondary) }
}ColorPalette¶
The 48 basic colours grid of the Custom Color Selector (colors:, selection:)
role swatches
Source
ColorPalette()ComboBox¶
ComboBox(items:, selection:, open:) — edit plus the separate drop-down arrow box
role select · arguments label · defaults variant: "dropdown" · variants dropdown, dropdownList, simple
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ComboBox("Label").variant("dropdown"); Text("dropdown").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ComboBox("Label").variant("dropdownList"); Text("dropdownList").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ComboBox("Label").variant("simple"); Text("simple").font(.caption).foregroundStyle(.secondary) }
}ControlPanel¶
Control Panel window: a grid of ProgramItems (Color, Fonts, Ports, …)
role card · arguments title · defaults kind: "window", title: "Control Panel", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ControlPanel() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ControlPanel() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ControlPanel() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ControlPanel() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}DEFPUSHBUTTON¶
Resource-script spelling
role button · arguments label · defaults variant: "default"
Source
DEFPUSHBUTTON("Label")DIALOG¶
role dialog · arguments title · defaults inline: True, variant: "dialog"
Source
DIALOG("Title") { Text("Content"); Button("Action") }DefPushButton¶
BS_DEFPUSHBUTTON — the default button
role button · arguments label · defaults variant: "default" · variants push, default
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { DefPushButton("Label").variant("push"); Text("push").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { DefPushButton("Label").variant("default"); Text("default").font(.caption).foregroundStyle(.secondary) }
}Desktop¶
The teal desktop; place windows with .offset(x:y:) (top-left anchored)
role zstack · defaults alignment: "topLeading"
Source
Desktop() { Text("Content"); Button("Action") }DesktopIcon¶
A minimized application icon on the desktop
role label · arguments title · defaults icon: "app", variant: "minimized"
Source
DesktopIcon("Title")DialogBox¶
DialogBox("Print Setup") { controls } actions: { Button… } — modal frame, caption with control-menu box
role dialog · arguments title · defaults inline: True, variant: "dialog"
Source
DialogBox("Title") { Text("Content"); Button("Action") }Directory¶
Directory("windows", expanded:) — folder icon; the selected one shows the open folder
role treeitem · arguments label · defaults folder: True
Source
Directory("Label")DirectoryTree¶
DirectoryTree { Directory("c:\") { Directory("windows").selected() } }
role tree · defaults variant: "directory"
Source
DirectoryTree() { TreeItem("Folder") { TreeItem("File") } }DirectoryWindow¶
DirectoryWindow("C:\WINDOWS\.") { DriveBar; HStack { DirectoryTree; FileList } }
role card · arguments title · defaults kind: "window", variant: "child" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { DirectoryWindow("Title") { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { DirectoryWindow("Title") { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { DirectoryWindow("Title") { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { DirectoryWindow("Title") { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}Drive¶
Drive("c", kind: .floppy|.hard|.network|.cdrom|.ram).selected()
role button · arguments label · defaults kind: "hard", variant: "drive" · variants drive
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Drive("Label").variant("drive"); Text("drive").font(.caption).foregroundStyle(.secondary) }
}DriveBar¶
Row of Drive buttons, then the volume label Static
role toolbar · defaults variant: "drivebar"
Source
DriveBar() { Button("Save"); Button("Share") }DropDownList¶
CBS_DROPDOWNLIST — no editing
role select · arguments label · defaults variant: "dropdownList"
Source
DropDownList("Label")Edit¶
Edit("C:\WINDOWS", label:) — single-line edit; kind: .multiline for MultiLineEdit
role textfield · arguments text
Source
Edit("Text")FileItem¶
FileItem("win.com", kind: .program|.document|.file|.folder, detail: "50,904")
role listitem · arguments title · defaults icon: "doc", kind: "document"
Source
FileItem("Title")FileList¶
FileList { FileItem("win.ini") … } — the right pane of a directory window
role list · defaults variant: "files"
Source
FileList() { Text("First item"); Text("Second item") }FileManager¶
File Manager window: MenuBar, then DirectoryWindow children
role card · arguments title · defaults kind: "window", title: "File Manager", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { FileManager() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { FileManager() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { FileManager() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { FileManager() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}GROUPBOX¶
Resource-script spelling
role card · arguments title · defaults variant: "groupbox"
Source
GROUPBOX("Title") { Text("Content"); Button("Action") }Gauge¶
The Setup percentage gauge (value 0…1)
role progress · arguments value · defaults variant: "gauge"
Source
Gauge(60)GroupBox¶
GroupBox("Orientation") { RadioButton… } — a black frame with the caption breaking the top line
role card · arguments title · defaults variant: "groupbox"
Source
GroupBox("Title") { Text("Content"); Button("Action") }IndexCard¶
IndexCard("Brown, Ana", "555-0134") — white card with the index line
role stickynote · arguments title, text · defaults color: "white", variant: "card"
Source
IndexCard("Title", "Text")LISTBOX¶
role list · defaults variant: "listbox"
Source
LISTBOX() { Text("First item"); Text("Second item") }ListBox¶
ListBox { ListBoxItem("Arial").selected() … }
role list · defaults variant: "listbox"
Source
ListBox() { Text("First item"); Text("Second item") }ListBoxItem¶
A list box line (icon:, detail:)
role listitem · arguments title
Source
ListBoxItem("Title")MDIChildWindow¶
MDI document window inside an MDIClient
role card · arguments title · defaults kind: "window", variant: "child" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { MDIChildWindow("Title") { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MDIChildWindow("Title") { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MDIChildWindow("Title") { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MDIChildWindow("Title") { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}MDIClient¶
MDI workspace (Application Workspace colour); children placed with .offset
role zstack · defaults alignment: "topLeading", kind: "mdiclient"
Source
MDIClient() { Text("Content"); Button("Action") }MENUITEM¶
Resource-script spelling of MenuItem
role menuitem · arguments label
Source
MENUITEM("Label")MSDOSPrompt¶
Full-screen-ish MS-DOS Prompt; lines starting with "C:\>" are commands
role code · arguments code · defaults kind: "dos", variant: "terminal"
Source
MSDOSPrompt("let total = items.count")MSGraph¶
Microsoft Graph chart in the 16-colour VGA palette (kind:)
role chart
Source
MSGraph(values: [3, 5, 2, 6, 4])Menu¶
Menu("File", open: true) { MenuItem("Open...", shortcut: "Ctrl+O") }
role menu · arguments label · defaults caret: False, variant: "menubar"
Source
Menu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }MenuBar¶
MenuBar { Menu("File") { MenuItem… } } — first letters are underlined as mnemonics
role toolbar · defaults variant: "menubar"
Source
MenuBar() { Button("Save"); Button("Share") }MenuItem¶
MenuItem("Save As...", shortcut:, checked:, disabled:)
role menuitem · arguments label
Source
MenuItem("Label")MessageBox¶
MessageBox("Program Manager", message:, icon: .stop|.exclamation|.information|.question, buttons: ["OK", "Cancel"], primary: "OK")
role dialog · arguments title · defaults icon: "info.circle", inline: True, variant: "information" · variants stop, exclamation, information, question
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { MessageBox("Title") { Text("Content"); Button("Action") }.variant("stop"); Text("stop").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MessageBox("Title") { Text("Content"); Button("Action") }.variant("exclamation"); Text("exclamation").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MessageBox("Title") { Text("Content"); Button("Action") }.variant("information"); Text("information").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { MessageBox("Title") { Text("Content"); Button("Action") }.variant("question"); Text("question").font(.caption).foregroundStyle(.secondary) }
}ModalDialog¶
A DialogBox presented over the screen
role dialog · arguments title · defaults variant: "dialog"
Source
ModalDialog("Title") { Text("Content"); Button("Action") }MultiLineEdit¶
ES_MULTILINE edit (rows:)
role textfield · arguments text · defaults kind: "multiline"
Source
MultiLineEdit("Text")Notepad¶
Notepad window: MenuBar + MultiLineEdit
role card · arguments title · defaults kind: "window", title: "Notepad - (Untitled)", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Notepad() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Notepad() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Notepad() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Notepad() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}POPUP¶
Resource-script spelling of Menu
role menu · arguments label · defaults caret: False, variant: "menubar"
Source
POPUP("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }PUSHBUTTON¶
Resource-script spelling
role button · arguments label · defaults variant: "push"
Source
PUSHBUTTON("Label")PasswordEdit¶
ES_PASSWORD edit (asterisks)
role textfield · arguments text · defaults kind: "password"
Source
PasswordEdit("Text")PopupMenu¶
A free-standing drop-down menu (open)
role menu
Source
PopupMenu() { Button("Open"); Button("Save"); Divider(); Button("Close") }ProgramGroup¶
Program group child window: a grid of ProgramItems
role card · arguments title · defaults kind: "window", variant: "child" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ProgramGroup("Title") { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ProgramGroup("Title") { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ProgramGroup("Title") { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ProgramGroup("Title") { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}ProgramGroupIcon¶
A minimized program group at the bottom of Program Manager
role label · arguments title · defaults icon: "square.grid.2x2", variant: "group"
Source
ProgramGroupIcon("Title")ProgramItem¶
ProgramItem("Notepad", icon: "doc") — 32×32 icon over a caption; .selected()
role label · arguments title · defaults icon: "app", variant: "item"
Source
ProgramItem("Title")ProgramManager¶
Program Manager window: put a MenuBar and an MDIClient of ProgramGroups inside
role card · arguments title · defaults kind: "window", title: "Program Manager", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ProgramManager() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ProgramManager() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ProgramManager() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { ProgramManager() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}ProgressBar¶
Setup gauge: navy fill in a sunken box
role progress · arguments label
Source
ProgressBar("Label")PushButton¶
BS_PUSHBUTTON
role button · arguments label · defaults variant: "push" · variants push, default
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { PushButton("Label").variant("push"); Text("push").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { PushButton("Label").variant("default"); Text("default").font(.caption).foregroundStyle(.secondary) }
}RTEXT¶
Right-aligned static text
role text · arguments content · defaults kind: "rtext"
Source
RTEXT("Content")RadioButton¶
RadioButton("Portrait", checked: true)
role radio · arguments label
Source
RadioButton("Label")ScrollBar¶
ScrollBar(value: 0.3, orientation: .vertical) — arrow boxes and a square thumb
role slider · defaults orientation: "horizontal", variant: "scrollbar" · variants scrollbar
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { ScrollBar().variant("scrollbar"); Text("scrollbar").font(.caption).foregroundStyle(.secondary) }
}Static¶
A static text control (bold System font)
role text · arguments content
Source
Static("Content")StatusBar¶
StatusBar { StatusBarPane("Selected 1 file(s)") }
role toolbar · defaults variant: "statusbar"
Source
StatusBar() { Button("Save"); Button("Share") }StatusBarPane¶
A sunken status-bar pane
role text · arguments content · defaults kind: "pane"
Source
StatusBarPane("Content")SystemMenu¶
The control menu (Restore, Move, Size, Minimize, Maximize, Close, Switch To…)
role menu
Source
SystemMenu() { Button("Open"); Button("Save"); Divider(); Button("Close") }ToolBar¶
WfW 3.11-style toolbar (File Manager)
role toolbar · defaults variant: "toolbar"
Source
ToolBar() { Button("Save"); Button("Share") }ToolBarButton¶
ToolBarButton("folder")
role button · arguments icon · defaults iconOnly: True, variant: "tool"
Source
ToolBarButton("star")TrackBar¶
A slider (Control Panel Mouse/Desktop style)
role slider · arguments label
Source
TrackBar("Label")Window¶
Overlapped window: navy caption, control-menu box, min/max arrows, sizing border. .variant(.inactive)
role card · arguments title · defaults kind: "window", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Window("Title") { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Window("Title") { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Window("Title") { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Window("Title") { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}Worksheet¶
Excel 4.0 worksheet: grey headers, black active-cell border
role spreadsheet
| A | B | |
|---|---|---|
| 1 | A | B |
| 2 | 1 | 2 |
| 3 | 3 | 4 |
Source
Worksheet(columns: ["A", "B"], rows: [[1, 2], [3, 4]])Write¶
Windows Write window
role card · arguments title · defaults kind: "window", title: "Write - (Untitled)", variant: "active" · variants active, inactive, maximized, child
Source
HStack(alignment: .top, spacing: 16) {
VStack(alignment: .leading, spacing: 4) { Write() { Text("Content"); Button("Action") }.variant("active"); Text("active").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Write() { Text("Content"); Button("Action") }.variant("inactive"); Text("inactive").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Write() { Text("Content"); Button("Action") }.variant("maximized"); Text("maximized").font(.caption).foregroundStyle(.secondary) }
VStack(alignment: .leading, spacing: 4) { Write() { Text("Content"); Button("Action") }.variant("child"); Text("child").font(.caption).foregroundStyle(.secondary) }
}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") }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") }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")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") }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)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") } }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") }