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
Source
Accordion() { Text("Content"); Button("Action") }AccordionItem¶
AccordionItem("Is it accessible?", expanded: true) { Text(…) }
role accordion · arguments 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
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) }
}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"
Source
AlertDialogAction()AlertDialogCancel¶
role button · arguments label · defaults label: "Cancel", variant: "outline"
Source
AlertDialogCancel()AspectRatio¶
Use with .aspectRatio(16/9, contentMode: .fill)
role zstack
Source
AspectRatio() { Text("Content"); Button("Action") }Avatar¶
Avatar("Shad CN", image: "…") — falls back to initials
role avatar · arguments name
Source
Avatar("Ana Lima")Badge¶
Badge("New", variant: .secondary)
role badge · arguments text · defaults variant: "default" · variants default, secondary, destructive, outline
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) }
}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
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
Source
Calendar()Card¶
Card("Title", description: "…") { content } footer: { … } action: { … }
role card · arguments title
Source
Card("Title") { Text("Content"); Button("Action") }CardAction¶
Top-right header action
role hstack
Source
CardAction() { Text("Content"); Button("Action") }CardContent¶
Card body
role vstack · defaults alignment: "stretch"
Source
CardContent() { Text("Content"); Button("Action") }CardDescription¶
Muted card description
role text · arguments content
Source
CardDescription("Content")CardFooter¶
Card footer row
role hstack
Source
CardFooter() { Text("Content"); Button("Action") }CardHeader¶
Title + description column
role vstack · defaults alignment: "leading", spacing: 6
Source
CardHeader() { Text("Content"); Button("Action") }CardTitle¶
Card title (leading-none font-semibold)
role text · arguments content
Source
CardTitle("Content")Carousel¶
role hstack · defaults spacing: 16
Source
Carousel() { Text("Content"); Button("Action") }CarouselContent¶
role hstack · defaults spacing: 16
Source
CarouselContent() { Text("Content"); Button("Action") }CarouselItem¶
role card · arguments title
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])Checkbox¶
Checkbox("Accept terms", checked: true)
role checkbox · arguments label
Source
Checkbox("Label")Collapsible¶
role accordion · arguments 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"
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") }CommandGroup¶
CommandGroup("Settings") { … } (heading:)
role section · arguments title
Source
CommandGroup("Title") { Text("First item"); Text("Second item") }CommandInput¶
role textfield · arguments placeholder · defaults kind: "search"
Source
CommandInput("Placeholder")CommandItem¶
CommandItem("Profile", systemImage: "user", shortcut: "⌘P")
role menuitem · arguments label
Source
CommandItem("Label")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")DataTable¶
Bordered table with row selection; toolbar: { … } footer: { … } · sortColumn:
role table · defaults selectable: True
| Name | Status | |
|---|---|---|
| Ana Lima | Active | |
| Ben Okafor | Away |
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"
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"
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¶
DropdownMenu("Open", open: true) { DropdownMenuLabel(…); DropdownMenuItem(…) } · trigger: { … }
role menu · arguments label · defaults variant: "outline"
Source
DropdownMenu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }DropdownMenuCheckboxItem¶
role menuitem · arguments label · defaults checked: False
Source
DropdownMenuCheckboxItem("Label")DropdownMenuContent¶
role group
Source
DropdownMenuContent() { Text("Content"); Button("Action") }DropdownMenuGroup¶
role group
Source
DropdownMenuGroup() { Text("Content"); Button("Action") }DropdownMenuItem¶
systemImage:, shortcut: "⇧⌘P", destructive: true
role menuitem · arguments label
Source
DropdownMenuItem("Label")DropdownMenuRadioItem¶
role menuitem · arguments label · defaults checked: False
Source
DropdownMenuRadioItem("Label")Empty¶
role vstack · defaults spacing: 12
Source
Empty() { Text("Content"); Button("Action") }Field¶
Field { FieldLabel; Input; FieldDescription }
role vstack · defaults alignment: "stretch", spacing: 8
Source
Field() { Text("Content"); Button("Action") }FieldGroup¶
role vstack · defaults alignment: "stretch", spacing: 24
Source
FieldGroup() { Text("Content"); Button("Action") }FieldSet¶
role vstack · defaults alignment: "stretch", spacing: 16
Source
FieldSet() { Text("Content"); Button("Action") }FormItem¶
role vstack · defaults alignment: "stretch", spacing: 8
Source
FormItem() { Text("Content"); Button("Action") }HoverCard¶
Floating preview card (w-64)
role card · arguments title
Source
HoverCard("Title") { Text("Content"); Button("Action") }Input¶
Input("m@example.com", label: "Email", text:, description:, type: .password)
role textfield · arguments placeholder
Source
Input("Placeholder")InputGroup¶
Input with leading icon (systemImage:) / prefix: / suffix:
role textfield · arguments placeholder
Source
InputGroup("Placeholder")InputOTP¶
InputOTP(items: ["1", "2", "", …], selection: 2) — one slot per item, the selected one focused
role segmented · arguments items
Source
InputOTP(["One", "Two", "Three"])Item¶
Item("Title", description:, systemImage:) { actions }
role listitem · arguments title
Source
Item("Title")KbdGroup¶
role hstack · defaults spacing: 4
Source
KbdGroup() { Text("Content"); Button("Action") }Menubar¶
Menubar { MenubarMenu("File", open: true) { MenubarItem(…) } … }
role toolbar
Source
Menubar() { Button("Save"); Button("Share") }MenubarCheckboxItem¶
role menuitem · arguments label · defaults checked: False
Source
MenubarCheckboxItem("Label")MenubarMenu¶
role menu · arguments label · defaults caret: False, variant: "ghost"
Source
MenubarMenu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }NavigationMenu¶
NavigationMenu { NavigationMenuItem("Getting started") { … }; NavigationMenuLink("Docs") }
role toolbar
Source
NavigationMenu() { Button("Save"); Button("Share") }NavigationMenuItem¶
role menu · arguments label · defaults variant: "ghost"
Source
NavigationMenuItem("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }NavigationMenuLink¶
role button · arguments label · defaults variant: "ghost"
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
Source
Popover("Title") { Text("Content"); Button("Action") }PopoverContent¶
role card · arguments title
Source
PopoverContent("Title") { Text("Content"); Button("Action") }RadioGroup¶
RadioGroup(selection: "Comfortable") { RadioGroupItem("Default") … }
role radiogroup · arguments label
Source
RadioGroup("Label")ResizablePanel¶
role vstack · defaults alignment: "stretch", spacing: 0
Source
ResizablePanel() { Text("Content"); Button("Action") }ResizablePanelGroup¶
ResizablePanelGroup { ResizablePanel { … }; ResizableHandle(); ResizablePanel { … } }
role hstack · defaults alignment: "stretch", spacing: 0
Source
ResizablePanelGroup() { Text("Content"); Button("Action") }ScrollArea¶
role scroll · arguments axes
Source
ScrollArea() { Text("Content"); Button("Action") }Select¶
Select("Theme", selection: "Dark") { SelectItem("Light") … } · open: true shows SelectContent
role select · arguments placeholder
Source
Select("Placeholder")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¶
Sidebar(variant: .inset) { SidebarGroup("Platform") { SidebarMenuButton(…) } } header: { … } footer: { … }
role sidebar · arguments title · variants 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) }
}SidebarFooter¶
role vstack · defaults alignment: "stretch", spacing: 8
Source
SidebarFooter() { Text("Content"); Button("Action") }SidebarGroup¶
role section · arguments title
Source
SidebarGroup("Title") { Text("First item"); Text("Second item") }SidebarHeader¶
role vstack · defaults alignment: "stretch", spacing: 8
Source
SidebarHeader() { Text("Content"); Button("Action") }SidebarInset¶
role vstack · defaults alignment: "stretch", spacing: 0
Source
SidebarInset() { Text("Content"); Button("Action") }SidebarMenuButton¶
SidebarMenuButton("Dashboard", systemImage: "layout-dashboard", selected:)
role navitem · arguments label
Source
SidebarMenuButton("Label")SidebarProvider¶
App shell: SidebarProvider { Sidebar(…); SidebarInset { … } }
role hstack · defaults alignment: "stretch", spacing: 0
Source
SidebarProvider() { Text("Content"); Button("Action") }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)Sonner¶
Sonner("Event has been created") — message: { … } for title + description; action: "Undo"
role toast · arguments message · defaults position: "bottom-right"
Source
Sonner("Message")Switch¶
Switch("Airplane Mode", isOn: true, description:)
role toggle · arguments label
Source
Switch("Label")Table¶
Table(columns: ["Invoice", …], 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¶
Tabs(selection: "Account") { TabsContent("Account") { … } TabsContent("Password") { … } }
role tabs · arguments items · defaults placement: "top"
Source
Tabs(["One", "Two", "Three"]) { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }Textarea¶
Textarea("Type your message here.", rows: 4)
role textfield · arguments placeholder · defaults kind: "multiline"
Source
Textarea("Placeholder")Toaster¶
role toast · arguments message · defaults position: "bottom-right"
Source
Toaster("Message")Toggle¶
Pressable toggle button: Toggle("B", isOn: true) or Toggle { Image(systemName:) }
role toggle · arguments label · defaults variant: "button"
Source
Toggle("Label")ToggleGroup¶
ToggleGroup(items: ["B", "I", "U"], selection: "B") or ToggleGroupItem children
role segmented · arguments items
Source
ToggleGroup(["One", "Two", "Three"])ToggleGroupItem¶
ToggleGroupItem("Bold") or (systemImage:)
role label · arguments title
Source
ToggleGroupItem("Title")Tooltip¶
Tooltip("Add to library") { Button(…) } · placement:
role tooltip · arguments text
Source
Tooltip("Text") { Text("Content"); Button("Action") }TypographyH1¶
role text · arguments content · defaults style: "h1"
Source
TypographyH1("Content")TypographyH2¶
role text · arguments content · defaults style: "h2"
Source
TypographyH2("Content")TypographyH3¶
role text · arguments content · defaults style: "h3"
Source
TypographyH3("Content")TypographyH4¶
role text · arguments content · defaults style: "h4"
Source
TypographyH4("Content")TypographyLarge¶
role text · arguments content · defaults style: "large"
Source
TypographyLarge("Content")TypographyLead¶
role text · arguments content · defaults style: "lead"
Source
TypographyLead("Content")TypographyMuted¶
role text · arguments content · defaults style: "muted"
Source
TypographyMuted("Content")TypographyP¶
role text · arguments content · defaults style: "p"
Source
TypographyP("Content")TypographySmall¶
role text · arguments content · defaults style: "small"
Source
TypographySmall("Content")Core vocabulary in this style¶
Board¶
Kanban board of BoardColumn children
role board
Source
Board() { BoardColumn("To do") { KanbanCard("Write copy") } }BoardColumn¶
BoardColumn("To do", count:, color:) { KanbanCard(…) }
role boardcolumn · arguments title
Source
BoardColumn("Title") { KanbanCard("Write copy"); KanbanCard("Review") }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)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") }DisclosureGroup¶
role accordion · arguments title
Source
DisclosureGroup("Title") { Text("Content"); Button("Action") }EmptyState¶
title, systemImage:, description: { actions }
role emptystate · arguments title
Source
EmptyState("Title")Gantt¶
scale: ["W1",…], tasks: [("Design", 0, 2, 0.6), …], today:
role gantt
Source
Gantt(tasks: [("Design", 0, 3), ("Build", 2, 5)])Grid¶
Grid of GridRow children, or columns: n
role grid
Source
Grid() { Text("Content"); Button("Action") }GroupBox¶
role card · arguments title
Source
GroupBox("Title") { Text("Content"); Button("Action") }HStack¶
Horizontal stack. spacing:, alignment: .top|.center|.bottom
role hstack
Source
HStack() { Text("Content"); Button("Action") }Image¶
Image("path.png") or Image(systemName: "star")
role image · arguments name
Source
Image().frame(width: 160, height: 96)KanbanCard¶
title, description:, tags: [..], assignees: [..], due:, comments:, priority:
role kanbancard · arguments title
Source
KanbanCard("Title")LabeledContent¶
role labeled · arguments label, value
Source
LabeledContent("Label", "Value") { Text("Content"); Button("Action") }LazyVGrid¶
columns: [GridItem(.flexible()), …] or a count
role grid
Source
LazyVGrid() { Text("Content"); Button("Action") }List¶
.listStyle(.insetGrouped|.plain|.sidebar|…)
role list
Source
List() { Text("First item"); Text("Second item") }Map¶
pins: [(x%, y%, "label")], route:, showsUserLocation:, height:
role map
Source
Map().frame(width: 160, height: 96)Menu¶
role menu · arguments label
Source
Menu("Label") { Button("Open"); Button("Save"); Divider(); Button("Close") }MessageBubble¶
MessageBubble("Hi", from: .me|.them, author:, time:, status:, reactions: [..])
role message · arguments text
Source
MessageBubble("Text")NavigationLink¶
role listitem · arguments title · defaults chevron: True
Source
NavigationLink("Title")NavigationSplitView¶
{ sidebar } content: { … } detail: { … }
role split
Source
NavigationSplitView() { Text("Content"); Button("Action") }NavigationStack¶
Content's .navigationTitle / .toolbar form the bar
role navstack
Source
NavigationStack() { Text("Content"); Button("Action") }Picker¶
Picker("Size", selection: "M") { Text("S") … }
role select · arguments label
Source
Picker("Label")Placeholder¶
A labelled box for maps, charts, media
role placeholder · arguments label
Source
Placeholder("Label").frame(width: 160, height: 96)Pointer¶
Pointer(.arrow|.hand|.ibeam|.grab|.crosshair|.touch); place with .position
role pointer · arguments kind
Source
Pointer(.arrow)ProgressView¶
value: 0…1 (or total:); none = indeterminate
role progress · arguments label
Source
ProgressView("Label")RoundedRectangle¶
role shape · defaults shape: "rounded"
Source
RoundedRectangle().frame(width: 160, height: 96)Row¶
title, subtitle:, detail:, systemImage:, chevron:
role listitem · arguments title
Source
Row("Title")Schedule¶
days: [..], startHour:, endHour:, events: [("Standup", "Mon", 9, 9.5, .blue)], now:
role schedule
Source
Schedule()ScrollView¶
role scroll · arguments axes
Source
ScrollView() { Text("Content"); Button("Action") }SearchField¶
role textfield · arguments placeholder · defaults kind: "search"
Source
SearchField("Placeholder")Section¶
Section("Header") { … } footer: { … }
role section · arguments title
Source
Section("Title") { Text("First item"); Text("Second item") }SecureField¶
role textfield · arguments placeholder · defaults kind: "password"
Source
SecureField("Placeholder")SegmentedControl¶
role segmented · arguments items
Source
SegmentedControl(["One", "Two", "Three"])SelectionRect¶
a drag-selection rectangle; size with .frame, place with .position
role marquee
Source
SelectionRect()Sparkline¶
role chart · arguments values · defaults kind: "sparkline"
Source
Sparkline([3, 5, 2, 6, 4], values: [3, 5, 2, 6, 4])Spreadsheet¶
rows: [[…]], selection: "B2:C4", active:, formula:, sheets: [..], highlight: ["B3": .yellow]
role spreadsheet
| A | B | |
|---|---|---|
| 1 | A | B |
| 2 | 1 | 2 |
| 3 | 3 | 4 |
Source
Spreadsheet(columns: ["A", "B"], rows: [[1, 2], [3, 4]])Stat¶
Stat("Revenue", "$48k", change: "+12%", trend: [..], systemImage:)
role stat · arguments label, value
Source
Stat("Label", 60)Steps¶
role steps · arguments steps
Source
Steps(["Cart", "Shipping", "Payment"])StickyNote¶
StickyNote("Call Ana", color: .yellow, rotation: -2, author:)
role stickynote · arguments text
Source
StickyNote("Text")TabView¶
Children with .tabItem { Label } or Tab(…)
role tabs · defaults placement: "bottom"
Source
TabView() { Text("First tab").tabItem { Text("One") }; Text("Second tab").tabItem { Text("Two") } }Terminal¶
lines starting with "$ " are commands
role code · arguments code · defaults variant: "terminal"
Source
Terminal("let total = items.count")Text¶
Text with bold, italic, code Markdown
role text · arguments content
Source
Text("Content")TextEditor¶
role textfield · arguments text · defaults kind: "multiline"
Source
TextEditor("Text")TextField¶
TextField("Placeholder", text: "value")
role textfield · arguments placeholder
Source
TextField("Placeholder")Timeline¶
role timeline
Source
Timeline() { TimelineItem("Created"); TimelineItem("Shipped") }TimelineItem¶
title, time:, description:, systemImage:, status:
role timelineitem · arguments title
Source
TimelineItem("Title")ToolbarItem¶
ToolbarItem(placement: .topBarTrailing) { … }
role toolbaritem
Source
ToolbarItem() { Text("Content"); Button("Action") }ToolbarItemGroup¶
role toolbaritem
Source
ToolbarItemGroup() { Text("Content"); Button("Action") }Tree¶
Tree { TreeItem("src") { TreeItem("main.swift") } }
role tree
Source
Tree() { TreeItem("Folder") { TreeItem("File") } }TreeItem¶
label, systemImage:, folder:, expanded:, selected:, detail:
role treeitem · arguments label
Source
TreeItem("Label")VStack¶
Vertical stack. spacing:, alignment: .leading|.center|.trailing
role vstack
Source
VStack() { Text("Content"); Button("Action") }VideoPlayer¶
poster image, progress: 0…1, time:, duration:, playing:
role media · arguments image
Source
VideoPlayer().frame(width: 160, height: 96)Whiteboard¶
role canvas · defaults grid: "dots"
Source
Whiteboard() { Text("Content"); Button("Action") }.frame(width: 160, height: 96)ZStack¶
Overlapping layers. alignment:
role zstack
Source
ZStack() { Text("Content"); Button("Action") }