Documentation Index Fetch the complete documentation index at: https://docs.prism.byescaleira.com/llms.txt
Use this file to discover all available pages before exploring further.
Every component in PrismUI reads the active theme from the SwiftUI environment, respects Dynamic Type, and meets Apple HIG minimum tap-target sizes. You don’t pass colors or fonts as arguments — you configure variants and behaviors, and the design system handles the rest. The sections below cover all six component categories with representative code examples for each.
Primitives
Composites
Forms
Lists
Layout
Navigation
Primitives are the atomic building blocks: buttons, inputs, cards, avatars, and status indicators. PrismButton supports six visual variants, async actions with a built-in loading state, haptic feedback, and automatic disable handling.public enum PrismButtonVariant {
case filled
case tinted
case bordered
case plain
case glass
case glassProminent
}
Filled (primary action)
Bordered (secondary action)
Custom label with
PrismButton ( "Sign In" , variant : . filled ) {
await viewModel. signIn ()
}
The action closure is async, so you can await any asynchronous call directly. PrismButton shows a ProgressView while the action runs and re-enables itself when it completes. PrismTextField PrismTextField validates input on focus-loss and shows inline error messages. Five built-in validation rules are available, plus a .custom escape hatch.// Required field
PrismTextField ( "Username" , text : $username,
validation : . required ( "Username is required" ))
// Email pattern
PrismTextField ( "Email" , text : $email,
validation : . pattern (
"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+ \\ .[A-Za-z]{2,}" ,
"Enter a valid email address"
))
// Custom validator
PrismTextField ( "Password" , text : $password,
validation : . custom { value in
value. count < 8 ? "At least 8 characters required" : nil
})
Available validation cases: .required, .minLength, .maxLength, .pattern, .custom. PrismCard PrismCard is a themed container with configurable surface color, corner radius, and elevation.PrismCard ( surface : . surface , radius : . lg , elevation : . low ) {
VStack ( alignment : . leading , spacing : SpacingToken. sm . rawValue ) {
Text ( "Account Overview" )
. prismFont (. headline )
Text ( "$4,218.00" )
. prismFont (. largeTitle )
. prismColor (. brand )
}
}
PrismAvatar PrismAvatar supports images, remote URLs with async loading, and initials fallback. An optional status indicator shows presence state.// Initials with status
PrismAvatar ( initials : "JD" , size : . large , status : . online )
// Remote image
PrismAvatar ( url : user. avatarURL , size : . medium , status : . away )
Available sizes: .small (32 pt), .medium (40 pt), .large (56 pt), .xLarge (80 pt), .custom(CGFloat). Available status cases: .online, .offline, .busy, .away. PrismTag PrismTag renders a small pill label for statuses, categories, and labels. An optional SF Symbol icon appears before the text.PrismTag ( "Active" , style : . success , icon : "checkmark.circle" )
PrismTag ( "Pending" , style : . warning )
PrismTag ( "Error" , style : . error )
PrismTag ( "Beta" , style : . brand )
Available styles: .default, .success, .warning, .error, .info, .brand. PrismProgressBar PrismProgressBar renders determinate or indeterminate progress. The indeterminate shimmer automatically stops when the user enables Reduce Motion .// Determinate
PrismProgressBar ( value : 0.65 , label : "Upload progress" )
// Indeterminate
PrismProgressBar ( label : "Loading…" )
PrismLoadingState PrismLoadingState standardizes how you represent loading, empty, and error states across your app.PrismLoadingState (. loading )
PrismLoadingState (. empty (
title : "No results" ,
message : "Try adjusting your search" ,
icon : "magnifyingglass"
))
PrismLoadingState (. error ( "Something went wrong" , retry : {
viewModel. reload ()
}))
PrismSkeletonView PrismSkeletonView shows a shimmer placeholder for content that is loading. Four pre-built layouts are available, plus a custom size.PrismSkeletonView (. card )
PrismSkeletonView (. list ( rows : 4 ))
PrismSkeletonView (. avatar )
PrismSkeletonView (. custom ( width : 200 , height : 20 , radius : . sm ))
Other primitives Component Description PrismChipSelectable tag with dismiss button PrismIconSF Symbol with token-driven size and color PrismAsyncImageAsync image with shimmer loading state and error fallback PrismTableData table with sortable columns PrismTimelineViewVertical timeline with step indicators PrismGaugeCircular gauge with arc-shaped progress PrismButtonGroupHorizontal group of segmented buttons PrismExpandableCardCard with animated expand/collapse content
Composites are multi-part UI patterns built from primitives. They handle interaction, animation, and layout internally. PrismToast PrismToast is a view modifier that shows an auto-dismissing notification. Use it on a root container so the toast appears above all content.ContentView ()
. prismToast (
isPresented : $showSuccess,
"Changes saved" ,
icon : "checkmark.circle.fill" ,
style : . success ,
edge : . bottom ,
duration : 3
)
Available styles: .neutral, .success, .error, .info. PrismAlert PrismAlert is a view modifier that wraps the system alert API with a cleaner builder interface.Custom actions
Confirmation shorthand
view. prismAlert (
isPresented : $showAlert,
title : "Delete item?" ,
message : "This action cannot be undone." ,
actions : [
. destructive ( "Delete" ) { viewModel. delete () },
. cancel (),
]
)
PrismBottomSheet PrismBottomSheet is a draggable sheet with configurable snap points. Use it as a modifier with .prismBottomSheet().ContentView ()
. prismBottomSheet (
isPresented : $showSheet,
snapPoints : [ 0.4 , 0.85 ]
) {
FilterPanelView ()
}
The sheet snaps to the nearest fractional height when the user releases the drag. Dragging below the lowest snap point dismisses the sheet. PrismSearchBar PrismSearchBar includes a debounced text binding, a clear button, and keyboard submit handling.@State private var query = ""
PrismSearchBar (
text : $query,
placeholder : "Search transactions" ,
debounce : . milliseconds ( 300 )
) {
viewModel. search (query)
}
PrismEmptyState PrismEmptyState renders a full-page placeholder with icon, title, optional message, and an optional call-to-action view.PrismEmptyState (
icon : "tray" ,
title : "No messages" ,
message : "New messages will appear here."
) {
PrismButton ( "Compose" , variant : . filled ) {
showCompose = true
}
}
PrismOnboarding PrismOnboarding renders a paged walkthrough with a progress dot indicator and Continue/Get Started button.PrismOnboarding ( pages : [
. init ( icon : "star.fill" , title : "Welcome" , message : "Discover everything Prism can do." ),
. init ( icon : "bell.fill" , title : "Stay in sync" , message : "Get notified when things change." ),
. init ( icon : "lock.fill" , title : "Secure" , message : "Your data is always private." ),
]) {
AppState. shared . hasSeenOnboarding = true
}
PrismCountdownTimer PrismCountdownTimer shows a circular progress ring with a formatted countdown label. The ring color shifts from .interactive to .warning at 25% remaining and to .error at 10%.PrismCountdownTimer (
seconds : 120 ,
autoStart : true ,
showLabel : true
) {
viewModel. submitAnswer ()
}
Other composites Component Description PrismBannerPersistent banner below the navigation bar PrismCarouselHorizontal paging carousel with page indicators PrismMenuThemed context and pull-down menu PrismToolbarContextual toolbar with leading and trailing items PrismTooltipPopover tooltip anchored to any view PrismNotificationBannerNotification-style banner with app-style layout
Form components handle user input. All form controls inherit the active theme’s .interactive color for tints, borders, and focus rings. PrismToggle PrismToggle wraps the system Toggle with an optional description line and icon.PrismToggle (
"Push notifications" ,
isOn : $notificationsEnabled,
description : "Receive alerts for new activity" ,
icon : "bell.badge"
)
PrismSlider PrismSlider shows a title, optional current-value label, and step support.PrismSlider (
"Volume" ,
value : $volume,
in : 0 ... 100 ,
step : 1 ,
format : { " \( Int ( $0 ) ) %" }
)
PrismSegmentedControl PrismSegmentedControl wraps the system segmented picker with an optional label above the segments.PrismSegmentedControl ( "View" , selection : $selectedTab) {
Text ( "List" ). tag ( 0 )
Text ( "Grid" ). tag ( 1 )
Text ( "Map" ). tag ( 2 )
}
PrismRating PrismRating renders a star rating input with optional half-star support.PrismRating ( value : $rating, maxStars : 5 , allowHalf : true )
PrismPinField PrismPinField renders individual character cells for OTP and PIN entry. It sets textContentType(.oneTimeCode) automatically on iOS.PrismPinField ( code : $pinCode, length : 6 , isSecure : true )
PrismSecureField PrismSecureField is a password field with a visibility toggle button.PrismSecureField ( "Password" , text : $password)
Component Description PrismPickerLabel + picker with icon support PrismDatePickerThemed date picker with icon and date range PrismStepperIncrement/decrement stepper with label PrismTextAreaMulti-line text input with character count PrismColorWellColor picker with preset swatches and custom selection
List components handle common patterns for displaying rows of data. PrismRow and PrismDisclosureRow PrismRow is a standardized list row with icon, title, subtitle, and a trailing accessory slot.Basic row
Row with trailing content
Disclosure row (chevron)
PrismRow (
"Notifications" ,
subtitle : "Manage alert preferences" ,
icon : "bell" ,
iconColor : . interactive
)
Both types enforce a 44 pt minimum height and combine children into a single accessibility element. PrismBadge PrismBadge overlays a notification count on any view. Counts above the max threshold display as 99+.Image ( systemName : "envelope" )
. font (. title2 )
. prismBadge (unreadCount, max : 99 )
PrismList PrismList wraps the system List with themed styling.PrismList {
ForEach (items) { item in
PrismRow (item. title , icon : item. icon )
}
}
Swipe actions are available through the standard .swipeActions() modifier on list rows. Layout components handle page-level structure and adaptive sizing. PrismScaffold PrismScaffold is a screen-level container that fills the background with the theme’s background token and extends into safe-area insets.PrismScaffold {
VStack {
HeaderView ()
ContentView ()
}
}
Override the background token for themed sections: PrismScaffold ( background : . backgroundSecondary ) {
SettingsListView ()
}
PrismAdaptiveStack PrismAdaptiveStack switches between HStack and VStack based on the horizontal size class. Use it to build layouts that adapt automatically between iPhone and iPad.PrismAdaptiveStack ( spacing : . lg ) {
SummaryCard ()
ChartView ()
}
On compact width (iPhone), the children stack vertically. On regular width (iPad), they arrange horizontally. Other layout components Component Description PrismSectionGrouped section with header and footer PrismGridResponsive grid with configurable column count PrismSpacerToken-driven spacer using SpacingToken
Navigation components bridge PrismUI with PrismArchitecture and the system navigation APIs. PrismNavigationView PrismNavigationView wraps NavigationStack and binds to a PrismRouter for type-safe, programmatic navigation. Sheet and full-screen cover presentations are handled automatically.PrismNavigationView ( router : router) {
HomeView ()
} destination : { route in
switch route {
case . detail ( let id) : DetailView ( id : id)
case . settings : SettingsView ()
}
}
PrismTabView PrismTabView wraps the system TabView with a .prismTab() modifier that sets the icon, title, and optional badge count.PrismTabView ( selection : $selectedTab) {
FeedView ()
. prismTab ( "Feed" , icon : "house" , tag : 0 )
SearchView ()
. prismTab ( "Search" , icon : "magnifyingglass" , tag : 1 )
InboxView ()
. prismTab ( "Inbox" , icon : "bell" , tag : 2 , badge : unreadCount)
ProfileView ()
. prismTab ( "Profile" , icon : "person.circle" , tag : 3 )
}
PrismSheet .prismSheet() presents a sheet with configurable presentation detents, drag indicator visibility, and interactive dismiss control.Boolean binding
Item binding
view. prismSheet (
isPresented : $showFilter,
detents : [. medium , . large ],
showDragIndicator : true
) {
FilterView ()
}
PrismSplitView PrismSplitView adapts between a sidebar/detail layout on iPad and macOS, and a standard navigation stack on iPhone.PrismSplitView {
SidebarView ()
} detail : {
DetailView ()
}