Skip to content
Studio

StudioKit

StudioKit is the SwiftUI implementation of the Studio design system for iPhone, iPad and Mac (iOS 18+, macOS 15+). This tree implements Studio 2.1 (StudioRelease.version, which a test keeps equal to tokens.json's release); the package's own version is set at release. It is a Swift package, built in the Swift 6 language mode. Every value comes from packages/system/DESIGN.md through the generated Sources/StudioKit/Generated/StudioTokens.swift.

Status: written and syntax-checked, not compiled. No Swift toolchain runs where this release was made. Each file passes two checks:

  • node tools/swift-syntax.mjs, a tree-sitter parse that also checks token names.
  • A symbol cross-check, node packages/swift/scripts/swift-symbols.mjs: every StudioColor.x, StudioSpace.x, StudioComponent.X.y and .studioText(.role) must exist in the generated file.

Neither check proves the code builds. Run swift build and swift test --package-path packages/swift before you depend on it. The risks are listed under Open items.

import StudioKit

@main struct StudioApp: App {
    init() { StudioFonts.register() }
    var body: some Scene {
        WindowGroup {
            ContentView()
                .studioToasts()          // one toast centre per window
                .studioTheme(appearance: .system, density: .airy)
        }
    }
}

StudioCard {
    StudioKicker("Create")
    StudioTwoToneTitle("Start something ", accent: "new.", role: .headlineMd)
    StudioButton("New", systemImage: "plus", variant: .primary) { create() }
}

The full public API, with every initialiser, is in the API list below and in the Xcode Quick Help.

What is generated

PathSourceEdit?
Sources/StudioKit/Generated/StudioTokens.swiftnpm run tokens from packages/system/DESIGN.mdNever
Sources/StudioKit/Resources/Fonts/node tools/sync-fonts.mjs from packages/system/fonts/Never
Tests/StudioKitTests/Resources/tokens.jsontools/sync-package.mjs from packages/system/dist/tokens.jsonNever
Tests/StudioKitTests/TokenTable.swiftnode packages/swift/scripts/token-table.mjs (every tokens.json key beside its Swift symbol; --check for drift)Regenerate when keys change; the count tests fail until you do
Everything else in Sources/ and Tests/Hand-writtenYes

Token names follow the generator's rule, with the spec key in lowerCamelCase under its group. For example, StudioColor.onSurface2, StudioSpace.s3h, StudioThreshold.rowFoldAt and StudioComponent.ListRow.height. The full list is in DESIGN.md, in the Platform mapping section.

Components

Each public view reads the spec keys beside it and nothing else. The names follow the spec's Build names table.

StudioKitSpec keysNotes
View.studioText(_:), StudioTypeRole.*typography.*, type-transformEvery role, plus .kicker, .label, .meta
StudioTwoToneTitleaccent-word, headline-*One Text, so both faces wrap together
StudioKickerkicker, kicker-dot, page-kicker, section-kicker
StudioTheme (\.studioTheme), StudioAppearance, StudioDensityModedata-theme, data-density, data-contrast, data-transparency, densityThe density enum is StudioDensityMode because the generator uses StudioDensity for the overrides
StudioFrame, StudioPresentation, StudioSwitcher, StudioLadder, StudioRegioncontent-max, gutter*, band*, pageMdAt/pageLgAt, regions, ladder, resolve, switcher
View.studioGlass, StudioGlassGroupglass, glass-solid, glass-rim, glass-highlight, materials.glass
View.studioBorder, View.studioShadow, StudioDividerspacing.hairline, elevation.*, divider*
StudioButton, StudioButtonStyle (.studio(_:))button*, button-sm, button-lg
StudioIconButtonbutton-icon*, toolbar-icon, nav-icon-on
StudioFabButton, StudioFabStyle (.studioFab(isPrimary:))fab, fab-primary, button-primary-hover, button-primary-active, button-primary-disabledA 56pt floating circle. The style also fits a ShareLink or Menu label. Since 2.1 the Studio app uses the system tab bar instead; kept for other consumers
StudioDock, StudioDockItemdock, dock-item, dock-item-currentA glass tool pill. Text is capped at the largest non-accessibility size, and the large content viewer is on. The Studio app's page editor uses it on iPhone (Insert · Style · Preview)
StudioSegmented, StudioSegmentsegmented*
StudioFieldfield*, textareaonBlur runs when focus leaves, for validation on blur
StudioInputPill, StudioInputGroup, StudioDomainPickerinput-pill*, field-invalid, field-error, input-group, domain-picker, domain-globeStudioInputPill(error:) sets the invalid rim and the message
StudioSwatchPicker, StudioSwatchswatch, swatch-selected, field-label32pt circles in 44pt targets. They wrap when the container is narrow
StudioSearchFieldsearch-field*
StudioToggleRowtoggle-track*
StudioChip, StudioPlanChip, StudioBadgechip*, plan-chip, badge
StudioKindBadge, StudioKind, StudioKindTone, StudioSaveModel, StudioKindViewControlkind-badge, kind-dot-*, colors.kind-*The nine kinds (studio-react KINDS) in the New sheet's order with the spec's ids: label, plural, short word, blurb, glyph, tone (four colour families), metric, primary action, save model, view control, address. 2.1's site decodes as .biopage (init(storedValue:))
StudioDeltaPilldelta-pill*
StudioStatusDot, StudioStatusLabel, StudioStatusstatus-dot*, status-*, materials.status-haloDESIGN.md's one vocabulary, the same as studio-react's Status: Live, Paused, Draft, Failed, and the Editing dot. Local or sample data never shows Live
StudioSaveStateLabel, StudioSaveStatesave-state, save-state-failed, status-dot*Saved, Saving, Unsaved, Offline, Failed. Only Failed is prominent, with an optional Retry
StudioCardcard, card-feature
StudioCreateTile, StudioIconWellcreate-tile*, icon-well*, card-title, card-blurb
StudioCalloutcallout*onDismiss adds a close circle for a banner the reader may close
StudioSectionHeader, StudioCapsLinksection-header, section-kicker, caps-link*
StudioPageHead, StudioFactpage-head, page-lead, page-kicker, fact, fact-label
StudioStatTilestat-tile*, stat-label, stat-sub
StudioListRow, StudioThumblist-row*, list-row-thumb-*, separator-dot, button-icon-sm
StudioSparklinesparkline*Swift Charts; height defaults to spark-h
StudioAreaChart, StudioLegendItem, StudioSeriesPalettechart*, legend-*, chart-series-*
StudioRankRowrank-bar*
StudioAvataravatar*
StudioBrandMarknav-brand-mark
StudioMenu, StudioMenuItem, StudioMenuLabel, StudioMenuSeparatormenu*
StudioAccountMenuaccount-menu, menu-header*, plan-chip, segmented
StudioToast, StudioToastCenter, View.studioToasts(_:), View.studioToasts(), View.studioBottomChrome(isActive:)toast*, motion.toast-*studioToasts() gives a window its own centre. The lane sits s-4 above the bottom safe area, or s-2 above bottom chrome that publishes its height with .studioBottomChrome() (the narrow-navigation circles, the dock), as DESIGN.md's "above the dock" asks
View.studioConfirm, StudioModalmodal*
StudioSheet, View.studioSheetPresentationsheet*
StudioToolbar (View.studioToolbar), StudioToolbarPilltoolbar*, brand-pill, toolbar-pill
StudioEmptyStateempty-state*
View.studioSkeletonskeleton
StudioCanvascanvas
StudioPanelSectionpanel-section, panel-section-labelAn inspector group. Separate neighbours with StudioDivider(soft: true)
StudioPlaceholderArttemplate-art, colors.kind-*-surface, primary-softA geometric stand-in for a missing image. The spec's artwork palette isn't generated for Swift, so it uses the kind tints
StudioMeasuremeasure*ch measures, which the generator does not emit
StudioHomeHero, StudioHeroStathome-hero, home-hero-compact, home-hero-lead, hero-stats, hero-stat-card, hero-stat-labelHome's greeting, lead and three stats: a column at the end from tabbar-at, a 3-up row of cards below it that never wraps
StudioKindTilekind-tile, kind-tile-blurb, kind-tile-hoverA kind to start (Home's 2×2, the New sheet)
StudioComposercomposerThe paste-a-URL feature card; the host puts the fields and the lime Shorten in it
StudioLookCardlook-card, look-card-hoverA template in "Start from a look"
StudioEditorWorkspace, StudioEditorPane, StudioEditorPaneLabels, StudioEditorSheetBareditor-workspace, library-panel, editor-canvas, inspector-panel (the system inspector), editor-sheetbar, editor-sheetbar-item, editor-sheet-at, library-collapse-at, editor-panel-w, editor-panel-w-wideOne editor for every kind: library panel (glass, collapsible), canvas, .inspector; below editor-sheet-at, sheets from a glass bar (Library · Preview · Settings, or Blocks · Page · Settings)
StudioEditorTitleLabel, StudioZoomControleditor-pill, editor-pill-kindThe editor bar's kind-and-name menu label; the QR zoom (50–200% in quarters, adjustable for VoiceOver)
StudioLibraryTile, StudioLibraryRowlibrary-tile, library-tile-current, library-tile-hover, resource-row-compactThe library's New tiles and Recently edited rows
StudioInspectorSection, StudioMoreOptionsinspector-section, more-optionsAn inspector group outside a Form; the one collapsed More options with its hint
StudioEventCard, StudioFileCard, StudioSplashPreview, StudioCheckoutCard, StudioStaticFrameevent-card, file-card, splash-preview, checkout-card, static-frameWhat a visitor gets, on the canvas. StudioStaticFrame is a WKWebView with JavaScript off, navigation blocked and Cardsite's CSP prepended (sandboxed(_:)); drawn buttons are hidden from VoiceOver
StudioResultsLineresults-lineThe quiet count under a collection's toolbar, with an optional Clear filters
StudioAddressFieldaddress-field, field-label, field-invalid, field-focusDomain menu, "/", the slug in mono-md and Copy in one pill; error and onBlur as StudioField
StudioShareCardshare-cardThe preview of what is shared: kicker, title, address in mono, detail, an optional thumbnail and a row of actions
StudioObjectHead, StudioTypeCard, StudioSectionLabelobject-head, object-head-type, panel-section-labelThe heads of an editor: the icon well, the name edited in place with the kind as its serif accent word, a mono-caps caption of facts and a trailing control (the Active switch); the inspector's read-only type card; the mono-caps label over a group of fields, with an optional readout. The caption and label are uppercase, so never a sentence, an email or a URL
StudioDropIndicatordrop-indicatorThe primary-line rule where a dragged block lands
StudioBlockToolbar, StudioBlockHandleblock-toolbar, block-handleThe selected block's floating glass pill, and its 24pt grip in a 44pt target
StudioPaletteItempalette-item, palette-item-hoverA page-editor widget label; the caller makes it a Button and .draggable

Every gallery has a #Preview in light and in dark, in Sources/StudioKit/Previews/StudioPreviews.swift; the editor heads have theirs in Sources/StudioKit/Surfaces/StudioObjectHead.swift.

Liquid Glass

Glass belongs on functional chrome and never on content. This follows the HIG ("Don't use Liquid Glass in the content layer") and DESIGN.md's Apple platforms section.

  • The system draws the bars. Navigation bars, toolbars, tab bars, sidebars, inspectors, sheets, popovers and menus all come from the system. On OS 26+ they are already glass. StudioKit sets no bar backgrounds, and StudioToolbar only places items.
  • Studio's own floating chrome uses .studioGlass. That chrome is the toast, StudioToolbarPill, StudioDock, the menu StudioFabButton, StudioIconButton(isGlass: true) for canvas tools, and the editor workspace's library panel and narrow sheet bar. Group neighbouring pieces in StudioGlassGroup.
  • Content never takes glass. Cards, rows, tiles, stat tiles, charts, fields, the canvas, a sheet's body and dialogs all use surface with a hairline.
  • The primary action is an opaque lime capsule (or the lime StudioFabButton(isPrimary: true) circle), so on-primary ink keeps its contrast. Glass is never tinted lime.
  • The glass renders in one of three ways:

| Condition | Rendering | |---|---| | OS 26+ | glassEffect(.regular), interactive on controls | | Earlier OS | .regularMaterial, the spec's 90% glass fill, the glass-line rim, the lit top edge and the float shadow | | Reduce Transparency or Increase Contrast | Opaque glass-solid with its rim |

  • Materials/StudioGlass.swift is the only file that branches on the OS version.

Accessibility

SettingStudioKit's response
Dynamic TypeEvery role scales with its text style through UIFontMetrics, so 9pt captions grow too. Fixed layouts reflow at accessibility sizes: section headers stack, stat-tile deltas drop a line, list rows fold, and the page head's facts become tiles
Bold TextEvery role moves one weight step heavier
VoiceOverIcon-only controls require a label. Rows and stat tiles read as one element. Toggled and selected states carry .isSelected. The two-tone title is a header. Delta pills speak "Up 8.2%". Toasts are announced. Charts keep Swift Charts' chart navigation, and decorative sparklines are hidden
Increase ContrastHairlines become 1pt outline-strong, muted ink (.studioMuted) becomes on-surface-2, and glass becomes opaque
Reduce TransparencyGlass becomes opaque glass-solid with its rim
Reduce MotionNo press scale, no sliding selection, no toast drop and no hover nudges. Changes apply at once
Hit targetsEvery control's tappable area is at least 44pt (studioHitTarget), whatever its drawn size, on every platform
KeyboardControls are native Button, TextField, Toggle and Menu, so focus and Full Keyboard Access are the system's. Escape clears the search field, and the modal and sheet close buttons take .cancelAction
Colour aloneKinds carry a glyph or a name, statuses carry a word, deltas carry an arrow and a sign, and chart comparison lines are dashed

Line height

The spec writes line height the CSS way: the total line box as a multiple of the size. SwiftUI's lineSpacing adds space on top of the font's natural line height. StudioKit 1.x first applied size × (lineHeight − 1), which counted the natural leading twice. 2.0 measures the actual Core Text font and applies:

spacing = max(0, size × lineHeight − (ascent + descent + leading))

Display roles at 1.0 resolve to zero. SwiftUI can't set lines tighter than the font's own height, so multi-line display headlines run slightly looser than on the web. That difference is accepted.

Migrating from 1.x

2.0 is a rewrite on the new spec, with a new visual language. It is not a reskin. The things that changed:

1.x2.0
swift-tools-version: 5.9, iOS 17, macOS 14Tools 6.0 (Swift 6 mode), iOS 18, macOS 15
Certia and Editorial New fontsBounded, Instrument Serif, Inter Tight and JetBrains Mono. StudioFonts.register() is unchanged
Color.studioText, Color.studioAccent, Color.StudioPalette.*StudioColor.onSurface, StudioColor.primary, and so on. There is no raw palette; views use roles
1.x colours were light-only on macOSEvery colour resolves light and dark on both platforms
StudioSpace.s5 (20pt) as the card paddingStudioCard pads with card.padding, which is 16pt (s-4), or 24pt for .feature
StudioTextStyle cases (.display, .title, .body, .ui, .mono…)StudioTypeRole (StudioType.*). The old names remain as deprecated statics that point to the new role. StudioTextStyle is now the Dynamic Type anchor enum
.studioText(.kicker / .label / .meta)Kept, still uppercase captions: kicker = caption-md, label = caption-md, meta = caption-xs. Still never for sentences, emails or URLs
.studioMuted() modifier.foregroundStyle(.studioMuted), which follows Increase Contrast
StudioCard(flush:radius:)StudioCard(_ variant:isPadded:spacing:). flush: true becomes isPadded: false; the radius comes from the variant
StudioTextFieldStudioField (the spec's build name). StudioTextField remains as a deprecated typealias
StudioViewport bands (720 / 1100)No device bands. Thresholds are measured on containers (StudioThreshold.*, StudioLadder, StudioFrame)
StudioAppShell, StudioTopbar, StudioDock, StudioEditorShell, StudioCollectionBarRemoved. Use system containers: NavigationSplitView, TabView(.sidebarAdaptable), .toolbar with studioToolbar, .inspector, .searchable. 2.0's StudioDock is a different, smaller component: the editor's tool pill at compact width, with StudioDockItems
.studioGlass(cornerRadius:tint:interactive:).studioGlass(in:interactive:). There is no tint, because glass is never tinted
StudioGlassContainer, .studioGlassMorphStudioGlassGroup, .studioGlassID
StudioElevation enum (.flat, .raised) with .studioElevationGenerated StudioElevation.<tier> (StudioShadowSet) with .studioShadow(_:)
StudioToastCenter(duration:), .show(_:variant:)StudioToastCenter(autoDismiss:announce:), .show(_:tone:action:), with the spec's durations, a limit of three, pause on hover and focus, and a VoiceOver announcement. Prefer .studioToasts() per window to one centre at the App level, and mark bottom chrome with .studioBottomChrome() so toasts never cover it
StudioStatusPill, StudioBanner, StudioToneStudioStatusLabel and StudioStatus; StudioCallout and StudioCalloutTone
StudioConfirmDialog, .studioConfirm(item:…).studioConfirm(_:isPresented:message:confirmTitle:isDestructive:onConfirm:) on the system dialog, or StudioModal
StudioHapticsRemoved. Use .sensoryFeedback

Studio 2.1 additions

2.1 adds parts and changes nothing that exists, so 2.0 code builds unchanged:

ChangeNotes
New: StudioTodayCard, StudioTodayFigure, StudioAttentionRow, StudioResultsLine, StudioAddressField, StudioShareCard, StudioDropIndicator, StudioBlockToolbar, StudioBlockHandle, StudioPaletteItem (Surfaces/StudioWorkspace.swift)The content of the app shell and the two editing models. The shell itself is the system's: NavigationSplitView with a sidebar on iPad and Mac, TabView on iPhone, .toolbar, .searchable, .sheet; StudioKit adds no shell type
StudioCallout(…, onDismiss:)Optional; nil keeps 2.0's callout
StudioSparkline(…, height:)Optional; defaults to spark-h
StudioRelease.version is "2.4.0"Follows tokens.json
The new tokens (sidebar-w, drawer-w-wide, today-spark-h, collection-compact-at, the shell, collection, drawer and editor components, the code roles)Generated into StudioTokens.swift; StudioSpace.drawerW is now 480 (was 300)

Open items

These are the first places to look when this package is compiled:

  1. Swift 6 isolation with tools 6.0. The package is nonisolated by default. These pieces must build under strict checking:
    1. StudioMutedInk.resolve(in:), a nonisolated ShapeStyle that reads EnvironmentValues.
    2. StudioToast.Action's @MainActor @Sendable handler.
    3. The Task timers in StudioToastCenter.
    4. .studioBottomChrome(), which reads an optional @Environment(StudioToastCenter.self) and reports through onGeometryChange. Check that the first height arrives before the first toast, and that the toast lane drops back when the chrome disappears.
  2. Fonts and variable weight. Bounded's weight is applied on the wght axis through kCTFontVariationAttribute, and Font(CTFont) is used for every role. Check two things: that Font(ctFont) keeps the variation, and that .tracking and .lineSpacing apply to it. Also check StudioFonts.failures (a test asserts it is empty).
  3. Dynamic Type mapping. UIFontMetrics.scaledValue(for:compatibleWith:) is called with a trait collection built from DynamicTypeSize. Check that text sizes track the system's at accessibility sizes.
  4. Swift Charts. Check these calls in StudioCharts.swift:
    1. AreaMark(x:yStart:yEnd:)
    2. .font and .foregroundStyle on AxisValueLabel and AxisGridLine
    3. chartYScale(domain:) with a ClosedRange<Double>
  5. Menus with custom labels. Check that Menu with .menuStyle(.button) + .buttonStyle(.plain) + .menuIndicator(.hidden) keeps the domain picker's and the row overflow's custom label on macOS.
  6. ViewThatFits in stat tiles and section headers. Check that the label falls back to its own line before it truncates, at 390pt and at accessibility sizes.
  7. StudioMenu in a .popover. The width is fixed at 272pt. Check that it adapts when the popover becomes a sheet on iPhone.
  8. The narrow-navigation and editor parts. Check these:
    1. .studioFab(isPrimary:) on a ShareLink and a Menu label, on both platforms.
    2. accessibilityShowsLargeContentViewer() and .dynamicTypeSize(...DynamicTypeSize.xxxLarge) on StudioDock on macOS. Both are iOS 15 and macOS 12 API but aren't in the job's verified list.
    3. StudioField(onBlur:), which uses onChange(of: isFocused). Check that it fires on Tab, on a click elsewhere, and when the inspector sheet closes.
  9. studioHitTarget adds layout height (a 30pt chip lays out 44pt tall). This is the spec's rule ("44pt whatever its visible size"), but it changes spacing compared with the web. Check dense rows.
  10. The 2.1 parts. Check that StudioAddressField's domain Menu with a custom label keeps its look on macOS (as item 5), that StudioBlockToolbar's glass reads over canvas text on OS 26, and that StudioTodayCard's minimumScaleFactor keeps the 3-up row on one line at accessibility sizes.

API at a glance

Foundations:

  • StudioFonts.register()
  • .studioText(_:scaled:)
  • Font.studio(_:)
  • StudioTwoToneTitle
  • StudioKicker
  • .studioTheme(appearance:density:)
  • .studioDensity(_:)
  • \.studioTheme
  • .studioMuted
  • StudioFrame
  • StudioSwitcher
  • StudioLadder.resolve(width:regions:)
  • .studioHitTarget(visualHeight:)
  • .studioBorder(_:color:emphasis:)
  • .studioShadow(_:)
  • .studioGlass(in:interactive:)

The components are listed in the Components table. Each type's initialisers are documented in its source file.

Contents