Skip to content

Style options

An app’s look comes from two places: the tokens in theme.json (your colors, type sizes, spacing and corner radii) and the style on each component, which refers to those tokens by name. There is no CSS, and no values outside this page (style 0.1.0).

Option Accepts What it does
color $color.background, $color.surface, $color.primary, $color.secondary, $color.text, $color.muted, $color.border, $color.error, $color.success Text and icon color.
backgroundColor $color.background, $color.surface, $color.primary, $color.secondary, $color.text, $color.muted, $color.border, $color.error, $color.success Fill behind the component.
typography $typography.body, $typography.title, $typography.caption Text size and weight, from the theme.
padding $spacing.none, $spacing.xs, $spacing.sm, $spacing.md, $spacing.lg, $spacing.xl Space inside the edges.
margin $spacing.none, $spacing.xs, $spacing.sm, $spacing.md, $spacing.lg, $spacing.xl Space outside the edges.
gap $spacing.none, $spacing.xs, $spacing.sm, $spacing.md, $spacing.lg, $spacing.xl Space between children.
borderColor $color.background, $color.surface, $color.primary, $color.secondary, $color.text, $color.muted, $color.border, $color.error, $color.success Border color. Needs borderWidth.
borderWidth whole number, 0 to 4 Border thickness in points.
radius $radius.none, $radius.sm, $radius.md, $radius.lg Corner rounding.
shadow none, subtle, medium Drop shadow.
width auto, fill, half fill takes the full width, half takes half.
height auto, fill fill takes the available height.
align start, center, end, stretch How children line up across the layout direction.
justify start, center, end, space-between How children are spread along the layout direction.
flex whole number, 0 to 1 1 lets the component grow to fill a Row or Stack.
textAlign left, center, right Text alignment.

Every theme defines all 9 colors, as #RRGGBB. The starter project’s values are shown.

Token Starter value Used for
$color.background #F8FAFC The screen behind everything
$color.surface #FFFFFF Cards and the tab bar
$color.primary #2563EB Buttons, links and the selected tab
$color.secondary #7C3AED A second accent
$color.text #0F172A Main text
$color.muted #64748B Secondary text and unselected tabs
$color.border #CBD5E1 Lines and outlines
$color.error #DC2626 Problems
$color.success #16A34A Confirmation
Kind Names Starter values
$spacing none, xs, sm, md, lg, xl 0, 4, 8, 16, 24, 32 points
$radius none, sm, md, lg 0, 4, 8, 16 points
$typography body, title, caption 16/24 weight 400, 28/36 weight 700, 12/16 weight 400

Type always uses the iPhone’s system font. Sizes run from 10 to 48, weights are 400, 500, 600 or 700.

A preset is a named style in theme.json that components reuse with "preset": "name". The starter project defines:

{
"page": {
"padding": "$spacing.md",
"gap": "$spacing.md",
"backgroundColor": "$color.background"
},
"panel": {
"padding": "$spacing.md",
"radius": "$radius.md",
"backgroundColor": "$color.surface",
"shadow": "subtle"
},
"heading": {
"typography": "$typography.title",
"color": "$color.text"
}
}

A component’s own style is applied after its preset, so it can override single options.