Skip to content

shadcn/ui

Imitates: shadcn/ui · new-york style, neutral base (Radix primitives, Tailwind CSS v4) shadcn 3 · Tailwind CSS 4 · Pack id: shadcn · Selected by: pack="shadcn", import Shadcn, import ShadcnUI, import Radix · Default device: desktop (browser chrome)

154 own elements, plus 107 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(…) … }

role vstack · defaults alignment: "stretch", spacing: 0

ContentAction
Source
Accordion() { Text("Content"); Button("Action") }

AccordionItem

AccordionItem("Is it accessible?", expanded: true) { Text(…) }

role accordion · arguments title

Title
Source
AccordionItem("Title") { Text("Content"); Button("Action") }

Alert

Alert("Heads up!", description: "…", systemImage: "terminal", variant: .destructive)

role alert · arguments title · defaults variant: "default" · variants default, destructive

default
destructive
Source
HStack(alignment: .top, spacing: 16) {
  VStack(alignment: .leading, spacing: 4) { Alert("Title").variant("default"); Text("default").font(.caption).foregroundStyle(.secondary) }
  VStack(alignment: .leading, spacing: 4) { Alert("Title").variant("destructive"); Text("destructive").font(.caption).foregroundStyle(.secondary) }
}

AlertDescription

role text · arguments content

Content
Source
AlertDescription("Content")

AlertDialog

AlertDialog("Are you absolutely sure?", description: "…") { } actions: { AlertDialogCancel(); AlertDialogAction() }

role dialog · arguments title · defaults variant: "alertDialog"

Source
AlertDialog("Title") { Text("Content"); Button("Action") }

AlertDialogAction

role button · arguments label · defaults label: "Continue", variant: "default"

Continue
Source
AlertDialogAction()

AlertDialogCancel

role button · arguments label · defaults label: "Cancel", variant: "outline"

Cancel
Source
AlertDialogCancel()

AlertTitle

role text · arguments content

Content
Source
AlertTitle("Content")

AspectRatio

Use with .aspectRatio(16/9, contentMode: .fill)

role zstack

ContentAction
Source
AspectRatio() { Text("Content"); Button("Action") }

Avatar

Avatar("Shad CN", image: "…") — falls back to initials

role avatar · arguments name

AL
Source
Avatar("Ana Lima")

AvatarFallback

role avatar · arguments name

AL
Source
AvatarFallback("Ana Lima")

Badge

Badge("New", variant: .secondary)

role badge · arguments text · defaults variant: "default" · variants default, secondary, destructive, outline

Textdefault
Textsecondary
Textdestructive
Textoutline
Source
HStack(alignment: .top, spacing: 16) {
  VStack(alignment: .leading, spacing: 4) { Badge("Text").variant("default"); Text("default").font(.caption).foregroundStyle(.secondary) }
  VStack(alignment: .leading, spacing: 4) { Badge("Text").variant("secondary"); Text("secondary").font(.caption).foregroundStyle(.secondary) }
  VStack(alignment: .leading, spacing: 4) { Badge("Text").variant("destructive"); Text("destructive").font(.caption).foregroundStyle(.secondary) }
  VStack(alignment: .leading, spacing: 4) { Badge("Text").variant("outline"); Text("outline").font(.caption).foregroundStyle(.secondary) }
}

role breadcrumb · arguments items

Source
Breadcrumb(["One", "Two", "Three"])

Button

Button("Save", variant: .outline, size: .sm) · size default|sm|lg|icon · systemImage: lucide name

role button · arguments label · defaults variant: "default" · variants default, secondary, destructive, outline, ghost, link

Labeldefault
Labelsecondary
Labeldestructive
Labeloutline
Labelghost
Labellink
Source
HStack(alignment: .top, spacing: 16) {
  VStack(alignment: .leading, spacing: 4) { Button("Label").variant("default"); Text("default").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("destructive"); Text("destructive").font(.caption).foregroundStyle(.secondary) }
  VStack(alignment: .leading, spacing: 4) { Button("Label").variant("outline"); Text("outline").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("link"); Text("link").font(.caption).foregroundStyle(.secondary) }
}

ButtonGroup

Joined outline buttons

role toolbar · defaults variant: "group"

Source
ButtonGroup() { Button("Save"); Button("Share") }

Calendar

Calendar(selection: "2026-11-23") · range: [start, end]

role calendar

November 2026
SuMoTuWeThFrSa12345678910111213141516171819202122232425262728293012345
Source
Calendar()

Card

Card("Title", description: "…") { content } footer: { … } action: { … }

role card · arguments title

Title
ContentAction
Source
Card("Title") { Text("Content"); Button("Action") }

CardAction

Top-right header action

role hstack

ContentAction
Source
CardAction() { Text("Content"); Button("Action") }

CardContent

Card body

role vstack · defaults alignment: "stretch"

ContentAction
Source
CardContent() { Text("Content"); Button("Action") }

CardDescription

Muted card description

role text · arguments content

Content
Source
CardDescription("Content")

CardFooter

Card footer row

role hstack

ContentAction
Source
CardFooter() { Text("Content"); Button("Action") }

CardHeader

Title + description column

role vstack · defaults alignment: "leading", spacing: 6

ContentAction
Source
CardHeader() { Text("Content"); Button("Action") }

CardTitle

Card title (leading-none font-semibold)

role text · arguments content

Content
Source
CardTitle("Content")

role hstack · defaults spacing: 16

ContentAction
Source
Carousel() { Text("Content"); Button("Action") }

CarouselContent

role hstack · defaults spacing: 16

ContentAction
Source
CarouselContent() { Text("Content"); Button("Action") }

CarouselItem

role card · arguments title

Title
ContentAction
Source
CarouselItem("Title") { Text("Content"); Button("Action") }

CarouselNext

role button · defaults iconOnly: True, systemImage: "arrow-right", variant: "outline"

Source
CarouselNext()

CarouselPrevious

role button · defaults iconOnly: True, systemImage: "arrow-left", variant: "outline"

Source
CarouselPrevious()

Chart

Chart(kind: .area|.bar|.line|.pie|.donut, values:, series:, labels:) — chart-1…5

role chart

Source
Chart(values: [3, 5, 2, 6, 4])

ChartContainer

role chart

Source
ChartContainer(values: [3, 5, 2, 6, 4])

Checkbox

Checkbox("Accept terms", checked: true)

role checkbox · arguments label

Label
Source
Checkbox("Label")

Collapsible

role accordion · arguments title

Title
Source
Collapsible("Title") { Text("Content"); Button("Action") }

Combobox

Popover + Command pattern; trigger is an outline button with chevrons-up-down

role select · arguments placeholder · defaults trailingIcon: "chevrons-up-down"

Placeholder
Source
Combobox("Placeholder")

Command

Command { CommandInput(…); CommandGroup("Suggestions") { CommandItem(…) } }

role menu

Source
Command() { Button("Open"); Button("Save"); Divider(); Button("Close") }

CommandDialog

A Command palette in a modal

role dialog · defaults variant: "command"

Source
CommandDialog() { Text("Content"); Button("Action") }

CommandEmpty

role text · arguments content

Content
Source
CommandEmpty("Content")

CommandGroup

CommandGroup("Settings") { … } (heading:)

role section · arguments title

Title
First itemSecond item
Source
CommandGroup("Title") { Text("First item"); Text("Second item") }

CommandInput

role textfield · arguments placeholder · defaults kind: "search"

Placeholder
Source
CommandInput("Placeholder")

CommandItem

CommandItem("Profile", systemImage: "user", shortcut: "⌘P")

role menuitem · arguments label

Source
CommandItem("Label")

CommandList

role group

ContentAction
Source
CommandList() { Text("Content"); Button("Action") }

CommandSeparator

role divider

Source
CommandSeparator()

ContextMenu

An open context menu (standalone popup); place it with .offset

role menu

Source
ContextMenu() { Button("Open"); Button("Save"); Divider(); Button("Close") }

ContextMenuCheckboxItem

role menuitem · arguments label · defaults checked: False

Source
ContextMenuCheckboxItem("Label")

ContextMenuItem

role menuitem · arguments label

Source
ContextMenuItem("Label")

ContextMenuLabel

role text · arguments content

Content
Source
ContextMenuLabel("Content")

ContextMenuSeparator

role divider

Source
ContextMenuSeparator()

DataTable

Bordered table with row selection; toolbar: { … } footer: { … } · sortColumn:

role table · defaults selectable: True

NameStatus
Ana LimaActive
Ben OkaforAway
Source
DataTable(columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])

DatePicker

Outline button with a calendar icon; selection: "2026-11-23"

role datepicker · arguments label · defaults placeholder: "Pick a date"

Pick a date
Source
DatePicker("Label")

Dialog

Dialog("Edit profile", description: "…") { body } footer: { Button("Save changes") }

role dialog · arguments title · defaults closable: True

Source
Dialog("Title") { Text("Content"); Button("Action") }

DialogClose

role button · arguments label · defaults label: "Close", variant: "outline"

Close
Source
DialogClose()

Drawer

Bottom drawer (Vaul) with a drag handle

role dialog · arguments title · defaults variant: "sheet"

Source
Drawer("Title") { Text("Content"); Button("Action") }

DropdownMenu("Open", open: true) { DropdownMenuLabel(…); DropdownMenuItem(…) } · trigger: { … }

role menu · arguments label · defaults variant: "outline"

Label
Source
DropdownMenu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }

role menuitem · arguments label · defaults checked: False

Source
DropdownMenuCheckboxItem("Label")

role group

ContentAction
Source
DropdownMenuContent() { Text("Content"); Button("Action") }

role group

ContentAction
Source
DropdownMenuGroup() { Text("Content"); Button("Action") }

systemImage:, shortcut: "⇧⌘P", destructive: true

role menuitem · arguments label

Source
DropdownMenuItem("Label")

role text · arguments content

Content
Source
DropdownMenuLabel("Content")

role menuitem · arguments label · defaults checked: False

Source
DropdownMenuRadioItem("Label")

role divider

Source
DropdownMenuSeparator()

role text · arguments content

Content
Source
DropdownMenuShortcut("Content")

role menuitem · arguments label

Source
DropdownMenuSub("Label")

Empty

role vstack · defaults spacing: 12

ContentAction
Source
Empty() { Text("Content"); Button("Action") }

Field

Field { FieldLabel; Input; FieldDescription }

role vstack · defaults alignment: "stretch", spacing: 8

ContentAction
Source
Field() { Text("Content"); Button("Action") }

FieldDescription

role text · arguments content

Content
Source
FieldDescription("Content")

FieldGroup

role vstack · defaults alignment: "stretch", spacing: 24

ContentAction
Source
FieldGroup() { Text("Content"); Button("Action") }

FieldLabel

role text · arguments content

Content
Source
FieldLabel("Content")

FieldLegend

role text · arguments content

Content
Source
FieldLegend("Content")

FieldSeparator

role divider · arguments label

Source
FieldSeparator("Label")

FieldSet

role vstack · defaults alignment: "stretch", spacing: 16

ContentAction
Source
FieldSet() { Text("Content"); Button("Action") }

Form

role form

Name
Notifications
Source
Form() { TextField("Name"); Toggle("Notifications", isOn: true) }

FormDescription

role text · arguments content

Content
Source
FormDescription("Content")

FormItem

role vstack · defaults alignment: "stretch", spacing: 8

ContentAction
Source
FormItem() { Text("Content"); Button("Action") }

FormLabel

role text · arguments content

Content
Source
FormLabel("Content")

FormMessage

role text · arguments content

Content
Source
FormMessage("Content")

HoverCard

Floating preview card (w-64)

role card · arguments title

Title
ContentAction
Source
HoverCard("Title") { Text("Content"); Button("Action") }

Input

Input("m@example.com", label: "Email", text:, description:, type: .password)

role textfield · arguments placeholder

Placeholder
Source
Input("Placeholder")

InputGroup

Input with leading icon (systemImage:) / prefix: / suffix:

role textfield · arguments placeholder

Placeholder
Source
InputGroup("Placeholder")

InputOTP

InputOTP(items: ["1", "2", "", …], selection: 2) — one slot per item, the selected one focused

role segmented · arguments items

OneTwoThree
Source
InputOTP(["One", "Two", "Three"])

Item

Item("Title", description:, systemImage:) { actions }

role listitem · arguments title

Title
Source
Item("Title")

Kbd

Kbd("⌘K")

role text · arguments content

Content
Source
Kbd("Content")

KbdGroup

role hstack · defaults spacing: 4

ContentAction
Source
KbdGroup() { Text("Content"); Button("Action") }

Label

Form label (text-sm font-medium)

role label · arguments title

Title
Source
Label("Title")

Menubar { MenubarMenu("File", open: true) { MenubarItem(…) } … }

role toolbar

Source
Menubar() { Button("Save"); Button("Share") }

role menuitem · arguments label · defaults checked: False

Source
MenubarCheckboxItem("Label")

role menuitem · arguments label

Source
MenubarItem("Label")

role menu · arguments label · defaults caret: False, variant: "ghost"

Label
Source
MenubarMenu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }

role divider

Source
MenubarSeparator()

role text · arguments content

Content
Source
MenubarShortcut("Content")

NativeSelect

role select · arguments placeholder

Placeholder
Source
NativeSelect("Placeholder")

NavigationMenu { NavigationMenuItem("Getting started") { … }; NavigationMenuLink("Docs") }

role toolbar

Source
NavigationMenu() { Button("Save"); Button("Share") }

role menu · arguments label · defaults variant: "ghost"

Label
Source
NavigationMenuItem("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }

role button · arguments label · defaults variant: "ghost"

Label
Source
NavigationMenuLink("Label")

Pagination

Pagination(count: 10, page: 2) — Previous / numbers / Next

role pagination

Source
Pagination()

Popover

Floating panel (w-72 p-4 shadow-md); position it with .offset or an overlay

role card · arguments title

Title
ContentAction
Source
Popover("Title") { Text("Content"); Button("Action") }

PopoverContent

role card · arguments title

Title
ContentAction
Source
PopoverContent("Title") { Text("Content"); Button("Action") }

Progress

Progress(value: 60) of 100

role progress · arguments value

Source
Progress(60)

RadioGroup

RadioGroup(selection: "Comfortable") { RadioGroupItem("Default") … }

role radiogroup · arguments label

Label
Source
RadioGroup("Label")

RadioGroupItem

role radio · arguments label

Label
Source
RadioGroupItem("Label")

ResizableHandle

Drag handle between panels (drawn withHandle)

role divider

Source
ResizableHandle()

ResizablePanel

role vstack · defaults alignment: "stretch", spacing: 0

ContentAction
Source
ResizablePanel() { Text("Content"); Button("Action") }

ResizablePanelGroup

ResizablePanelGroup { ResizablePanel { … }; ResizableHandle(); ResizablePanel { … } }

role hstack · defaults alignment: "stretch", spacing: 0

ContentAction
Source
ResizablePanelGroup() { Text("Content"); Button("Action") }

ScrollArea

role scroll · arguments axes

ContentAction
Source
ScrollArea() { Text("Content"); Button("Action") }

Select

Select("Theme", selection: "Dark") { SelectItem("Light") … } · open: true shows SelectContent

role select · arguments placeholder

Placeholder
Source
Select("Placeholder")

SelectGroup

role group

ContentAction
Source
SelectGroup() { Text("Content"); Button("Action") }

SelectItem

role menuitem · arguments label

Source
SelectItem("Label")

SelectLabel

role text · arguments content

Content
Source
SelectLabel("Content")

Separator

Horizontal, or vertical inside an HStack

role divider

Source
Separator()

Sheet

Side panel; .side(.left|.right|.top|.bottom)

role dialog · arguments title · defaults closable: True, placement: "right", variant: "drawer"

Source
Sheet("Title") { Text("Content"); Button("Action") }

Sidebar(variant: .inset) { SidebarGroup("Platform") { SidebarMenuButton(…) } } header: { … } footer: { … }

role sidebar · arguments title · variants sidebar, floating, inset

sidebar
floating
inset
Source
HStack(alignment: .top, spacing: 16) {
  VStack(alignment: .leading, spacing: 4) { Sidebar("Title") { Text("Content"); Button("Action") }.variant("sidebar"); Text("sidebar").font(.caption).foregroundStyle(.secondary) }
  VStack(alignment: .leading, spacing: 4) { Sidebar("Title") { Text("Content"); Button("Action") }.variant("floating"); Text("floating").font(.caption).foregroundStyle(.secondary) }
  VStack(alignment: .leading, spacing: 4) { Sidebar("Title") { Text("Content"); Button("Action") }.variant("inset"); Text("inset").font(.caption).foregroundStyle(.secondary) }
}

SidebarContent

role group

ContentAction
Source
SidebarContent() { Text("Content"); Button("Action") }

SidebarFooter

role vstack · defaults alignment: "stretch", spacing: 8

ContentAction
Source
SidebarFooter() { Text("Content"); Button("Action") }

SidebarGroup

role section · arguments title

Title
First itemSecond item
Source
SidebarGroup("Title") { Text("First item"); Text("Second item") }

SidebarGroupLabel

role text · arguments content

Content
Source
SidebarGroupLabel("Content")

SidebarHeader

role vstack · defaults alignment: "stretch", spacing: 8

ContentAction
Source
SidebarHeader() { Text("Content"); Button("Action") }

SidebarInset

role vstack · defaults alignment: "stretch", spacing: 0

ContentAction
Source
SidebarInset() { Text("Content"); Button("Action") }

SidebarMenu

role group

ContentAction
Source
SidebarMenu() { Text("Content"); Button("Action") }

SidebarMenuBadge

role badge · arguments text

Text
Source
SidebarMenuBadge("Text")

SidebarMenuButton

SidebarMenuButton("Dashboard", systemImage: "layout-dashboard", selected:)

role navitem · arguments label

Label
Source
SidebarMenuButton("Label")

SidebarMenuItem

role navitem · arguments label

Label
Source
SidebarMenuItem("Label")

SidebarMenuSub

role group

ContentAction
Source
SidebarMenuSub() { Text("Content"); Button("Action") }

SidebarMenuSubItem

role navitem · arguments label

Label
Source
SidebarMenuSubItem("Label")

SidebarProvider

App shell: SidebarProvider { Sidebar(…); SidebarInset { … } }

role hstack · defaults alignment: "stretch", spacing: 0

ContentAction
Source
SidebarProvider() { Text("Content"); Button("Action") }

SidebarSeparator

role divider

Source
SidebarSeparator()

SidebarTrigger

role button · defaults iconOnly: True, size: "icon", systemImage: "panel-left", variant: "ghost"

Source
SidebarTrigger()

Skeleton

Skeleton().frame(width: 250, height: 16) · shape: .circle

role shape · defaults shape: "rounded"

Source
Skeleton().frame(width: 160, height: 96)

Slider

Slider(value: 50, in: 0...100) · value: [25, 75] for a range

role slider

Source
Slider()

Sonner

Sonner("Event has been created") — message: { … } for title + description; action: "Undo"

role toast · arguments message · defaults position: "bottom-right"

Message
Source
Sonner("Message")

Spinner

role progress · defaults variant: "spinner"

Source
Spinner()

Switch

Switch("Airplane Mode", isOn: true, description:)

role toggle · arguments label

Label
Source
Switch("Label")

Table

Table(columns: ["Invoice", …], rows: [[…]]) or TableRow children

role table

NameStatus
Ana LimaActive
Ben OkaforAway
Source
Table(columns: ["Name", "Status"], rows: [["Ana Lima", "Active"], ["Ben Okafor", "Away"]])

TableCell

role text · arguments content

Content
Source
TableCell("Content")

TableHead

role tablecolumn · arguments title

Source
TableHead("Title")

TableRow

role tablerow

Source
TableRow()

Tabs

Tabs(selection: "Account") { TabsContent("Account") { … } TabsContent("Password") { … } }

role tabs · arguments items · defaults placement: "top"

OneTwo
First tab
Source
Tabs(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }

TabsContent

role tab · arguments label

Source
TabsContent("Label")

TabsTrigger

role tab · arguments label

Source
TabsTrigger("Label")

Textarea

Textarea("Type your message here.", rows: 4)

role textfield · arguments placeholder · defaults kind: "multiline"

Placeholder
Source
Textarea("Placeholder")

Toast

role toast · arguments message · defaults position: "bottom-right"

Message
Source
Toast("Message")

Toaster

role toast · arguments message · defaults position: "bottom-right"

Message
Source
Toaster("Message")

Toggle

Pressable toggle button: Toggle("B", isOn: true) or Toggle { Image(systemName:) }

role toggle · arguments label · defaults variant: "button"

Label
Source
Toggle("Label")

ToggleGroup

ToggleGroup(items: ["B", "I", "U"], selection: "B") or ToggleGroupItem children

role segmented · arguments items

OneTwoThree
Source
ToggleGroup(["One", "Two", "Three"])

ToggleGroupItem

ToggleGroupItem("Bold") or (systemImage:)

role label · arguments title

Title
Source
ToggleGroupItem("Title")

Tooltip

Tooltip("Add to library") { Button(…) } · placement:

role tooltip · arguments text

ContentActionText
Source
Tooltip("Text") { Text("Content"); Button("Action") }

TypographyBlockquote

role text · arguments content

Content
Source
TypographyBlockquote("Content")

TypographyH1

role text · arguments content · defaults style: "h1"

Content
Source
TypographyH1("Content")

TypographyH2

role text · arguments content · defaults style: "h2"

Content
Source
TypographyH2("Content")

TypographyH3

role text · arguments content · defaults style: "h3"

Content
Source
TypographyH3("Content")

TypographyH4

role text · arguments content · defaults style: "h4"

Content
Source
TypographyH4("Content")

TypographyInlineCode

role text · arguments content

Content
Source
TypographyInlineCode("Content")

TypographyLarge

role text · arguments content · defaults style: "large"

Content
Source
TypographyLarge("Content")

TypographyLead

role text · arguments content · defaults style: "lead"

Content
Source
TypographyLead("Content")

TypographyMuted

role text · arguments content · defaults style: "muted"

Content
Source
TypographyMuted("Content")

TypographyP

role text · arguments content · defaults style: "p"

Content
Source
TypographyP("Content")

TypographySmall

role text · arguments content · defaults style: "small"

Content
Source
TypographySmall("Content")

Core vocabulary in this style

AppBar

role appbar · arguments title

Source
AppBar("Title") { Text("Content"); Button("Action") }

AreaChart

role chart · defaults kind: "area"

Source
AreaChart(values: [3, 5, 2, 6, 4])

AsyncImage

role image · arguments url

Source
AsyncImage().frame(width: 160, height: 96)

role alert · arguments title

Source
Banner("Title")

BarChart

role chart · defaults kind: "bar"

Source
BarChart(values: [3, 5, 2, 6, 4])

Board

Kanban board of BoardColumn children

role board

To do1
Write copy
Add card
Source
Board() { BoardColumn("To do") { KanbanCard("Write copy") } }

BoardColumn

BoardColumn("To do", count:, color:) { KanbanCard(…) }

role boardcolumn · arguments title

Title2
Write copy
Review
Add card
Source
BoardColumn("Title") { KanbanCard("Write copy"); KanbanCard("Review") }

BubbleChart

role chart · defaults kind: "bubble"

Source
BubbleChart(values: [3, 5, 2, 6, 4])

Callout

a numbered annotation; place with .position(x:y:)

role callout · arguments number, text

1Text
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

ContentAction
Source
Canvas() { Text("Content"); Button("Action") }.frame(width: 160, height: 96)

Capsule

role shape · defaults shape: "capsule"

Source
Capsule().frame(width: 160, height: 96)

Chip

role chip · arguments label

Label
Source
Chip("Label")

Circle

role shape · defaults shape: "circle"

Source
Circle().frame(width: 160, height: 96)

CodeBlock

role code · arguments code · defaults lineNumbers: False

let total = items.count
Source
CodeBlock("let total = items.count")

CodeEditor

CodeEditor("…", language: "swift", lineNumbers:, highlight: [3], tabs: [..])

role code · arguments code

1let total = items.count
Source
CodeEditor("let total = items.count")

Color

role color · arguments color

Source
Color(.blue).frame(width: 160, height: 96)

ColorSwatches

colors: [.red, "#0af", …], selection:

role swatches

Source
ColorSwatches()

ComboChart

role chart · defaults kind: "combo"

Source
ComboChart(values: [3, 5, 2, 6, 4])

Comment

author:, time:, avatar:

role message · arguments text · defaults variant: "comment"

Text
Source
Comment("Text")

ControlGroup

role toolbar · defaults variant: "group"

Source
ControlGroup() { Button("Save"); Button("Share") }

DisclosureGroup

role accordion · arguments title

Title
Source
DisclosureGroup("Title") { Text("Content"); Button("Action") }

Divider

role divider

Source
Divider()

DonutChart

role chart · defaults kind: "donut"

Source
DonutChart(values: [3, 5, 2, 6, 4])

Dropzone

role dropzone · arguments label

Label
Source
Dropzone("Label")

Ellipse

role shape · defaults shape: "ellipse"

Source
Ellipse().frame(width: 160, height: 96)

EmptyState

title, systemImage:, description: { actions }

role emptystate · arguments title

Title
Source
EmptyState("Title")

FloatingActionButton

role fab · arguments icon

Source
FloatingActionButton("star")

FunnelChart

role chart · defaults kind: "funnel"

Source
FunnelChart(values: [3, 5, 2, 6, 4])

Gantt

scale: ["W1",…], tasks: [("Design", 0, 2, 0.6), …], today:

role gantt

1234567
Design
Build
Source
Gantt(tasks: [("Design", 0, 3), ("Build", 2, 5)])

Gauge

role progress · arguments value · defaults variant: "gauge"

Source
Gauge(60)

GaugeChart

role chart · defaults kind: "gauge"

Source
GaugeChart(values: [3, 5, 2, 6, 4])

Grid

Grid of GridRow children, or columns: n

role grid

ContentAction
Source
Grid() { Text("Content"); Button("Action") }

GridRow

role gridrow

ContentAction
Source
GridRow() { Text("Content"); Button("Action") }

Group

role group

ContentAction
Source
Group() { Text("Content"); Button("Action") }

GroupBox

role card · arguments title

Title
ContentAction
Source
GroupBox("Title") { Text("Content"); Button("Action") }

HStack

Horizontal stack. spacing:, alignment: .top|.center|.bottom

role hstack

ContentAction
Source
HStack() { Text("Content"); Button("Action") }

Heatmap

role chart · defaults kind: "heatmap"

Source
Heatmap(values: [3, 5, 2, 6, 4])

Histogram

role chart · defaults kind: "histogram"

Source
Histogram(values: [3, 5, 2, 6, 4])

Icon

role icon · arguments name

Source
Icon("star")

IconButton

role button · arguments icon · defaults iconOnly: True

Source
IconButton("star")

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

Title
Source
KanbanCard("Title")

LabeledContent

role labeled · arguments label, value

LabelContentAction
Source
LabeledContent("Label", "Value") { Text("Content"); Button("Action") }

LazyHGrid

role grid

ContentAction
Source
LazyHGrid() { Text("Content"); Button("Action") }

LazyHStack

role hstack

ContentAction
Source
LazyHStack() { Text("Content"); Button("Action") }

LazyVGrid

columns: [GridItem(.flexible()), …] or a count

role grid

ContentAction
Source
LazyVGrid() { Text("Content"); Button("Action") }

LazyVStack

role vstack

ContentAction
Source
LazyVStack() { Text("Content"); Button("Action") }

LineChart

role chart · defaults kind: "line"

Source
LineChart(values: [3, 5, 2, 6, 4])

role link · arguments label, destination

Label
Source
Link("Label")

List

.listStyle(.insetGrouped|.plain|.sidebar|…)

role list

First item
Second item
Source
List() { Text("First item"); Text("Second item") }

ListItem

role listitem · arguments title

Title
Source
ListItem("Title")

Map

pins: [(x%, y%, "label")], route:, showsUserLocation:, height:

role map

Source
Map().frame(width: 160, height: 96)

role menu · arguments label

Label
Source
Menu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }

role menuitem · arguments label

Source
MenuItem("Label")

MessageBubble

MessageBubble("Hi", from: .me|.them, author:, time:, status:, reactions: [..])

role message · arguments text

Text
Source
MessageBubble("Text")

role navitem · arguments label

Label
Source
NavItem("Label")

role listitem · arguments title · defaults chevron: True

Title
Source
NavigationLink("Title")

{ sidebar } content: { … } detail: { … }

role split

Content
Action
Source
NavigationSplitView() { Text("Content"); Button("Action") }

Content's .navigationTitle / .toolbar form the bar

role navstack

ContentAction
Source
NavigationStack() { Text("Content"); Button("Action") }

role navstack

ContentAction
Source
NavigationView() { Text("Content"); Button("Action") }

Picker

Picker("Size", selection: "M") { Text("S") … }

role select · arguments label

Source
Picker("Label")

PieChart

role chart · defaults kind: "pie"

Source
PieChart(values: [3, 5, 2, 6, 4])

Placeholder

A labelled box for maps, charts, media

role placeholder · arguments label

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

Label
Source
ProgressView("Label")

RadarChart

role chart · defaults kind: "radar"

Source
RadarChart(values: [3, 5, 2, 6, 4])

RadioButton

role radio · arguments label

Label
Source
RadioButton("Label")

Rating

role rating · arguments value

Source
Rating(60)

Rectangle

role shape · defaults shape: "rectangle"

Source
Rectangle().frame(width: 160, height: 96)

RoundedRectangle

role shape · defaults shape: "rounded"

Source
RoundedRectangle().frame(width: 160, height: 96)

Row

title, subtitle:, detail:, systemImage:, chevron:

role listitem · arguments title

Title
Source
Row("Title")

ScatterChart

role chart · defaults kind: "scatter"

Source
ScatterChart(values: [3, 5, 2, 6, 4])

Schedule

days: [..], startHour:, endHour:, events: [("Standup", "Mon", 9, 9.5, .blue)], now:

role schedule

8:009:0010:0011:0012:0013:0014:0015:0016:0017:00
Mon
Tue
Wed
Thu
Fri
Source
Schedule()

ScrollView

role scroll · arguments axes

ContentAction
Source
ScrollView() { Text("Content"); Button("Action") }

SearchField

role textfield · arguments placeholder · defaults kind: "search"

Placeholder
Source
SearchField("Placeholder")

Section

Section("Header") { … } footer: { … }

role section · arguments title

Title
First itemSecond item
Source
Section("Title") { Text("First item"); Text("Second item") }

SecureField

role textfield · arguments placeholder · defaults kind: "password"

Placeholder
Source
SecureField("Placeholder")

SegmentedControl

role segmented · arguments items

OneTwoThree
Source
SegmentedControl(["One", "Two", "Three"])

SelectionRect

a drag-selection rectangle; size with .frame, place with .position

role marquee

Source
SelectionRect()

Spacer

role spacer

Source
Spacer()

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

AB
1AB
212
334
Source
Spreadsheet(columns: ["A", "B"], rows: [[1, 2], [3, 4]])

Stat

Stat("Revenue", "$48k", change: "+12%", trend: [..], systemImage:)

role stat · arguments label, value

Label
60
Source
Stat("Label", 60)

Stepper

role stepper · arguments label

Label
Source
Stepper("Label")

Steps

role steps · arguments steps

1Cart
2Shipping
3Payment
Source
Steps(["Cart", "Shipping", "Payment"])

StickyNote

StickyNote("Call Ana", color: .yellow, rotation: -2, author:)

role stickynote · arguments text

Text
Source
StickyNote("Text")

Tab

Tab("Home", systemImage: "house") { … }

role tab · arguments label

Source
Tab("Label")

TabView

Children with .tabItem { Label } or Tab(…)

role tabs · defaults placement: "bottom"

OneTwo
First tab
Source
TabView() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }

TableColumn

role tablecolumn · arguments title

Source
TableColumn("Title")

Tag

role chip · arguments label

Label
Source
Tag("Label")

Terminal

lines starting with "$ " are commands

role code · arguments code · defaults variant: "terminal"

Terminal
let total = items.count
Source
Terminal("let total = items.count")

Text

Text with bold, italic, code Markdown

role text · arguments content

Content
Source
Text("Content")

TextEditor

role textfield · arguments text · defaults kind: "multiline"

Text
Source
TextEditor("Text")

TextField

TextField("Placeholder", text: "value")

role textfield · arguments placeholder

Placeholder
Source
TextField("Placeholder")

Timeline

role timeline

Created
Shipped
Source
Timeline() { TimelineItem("Created"); TimelineItem("Shipped") }

TimelineItem

title, time:, description:, systemImage:, status:

role timelineitem · arguments title

Title
Source
TimelineItem("Title")

Toolbar

role toolbar

Source
Toolbar() { Button("Save"); Button("Share") }

ToolbarItem

ToolbarItem(placement: .topBarTrailing) { … }

role toolbaritem

ContentAction
Source
ToolbarItem() { Text("Content"); Button("Action") }

ToolbarItemGroup

role toolbaritem

ContentAction
Source
ToolbarItemGroup() { Text("Content"); Button("Action") }

Tree

Tree { TreeItem("src") { TreeItem("main.swift") } }

role tree

Folder
File
Source
Tree() { TreeItem("Folder") { TreeItem("File") } }

TreeItem

label, systemImage:, folder:, expanded:, selected:, detail:

role treeitem · arguments label

Label
Source
TreeItem("Label")

Treemap

role chart · defaults kind: "treemap"

Source
Treemap(values: [3, 5, 2, 6, 4])

VStack

Vertical stack. spacing:, alignment: .leading|.center|.trailing

role vstack

ContentAction
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"

ContentAction
Source
Whiteboard() { Text("Content"); Button("Action") }.frame(width: 160, height: 96)

ZStack

Overlapping layers. alignment:

role zstack

ContentAction
Source
ZStack() { Text("Content"); Button("Action") }