Primitives
The 5 Tamagui-styled atoms — Avatar, Button, Card, Input, Text.
These five primitives are the smallest pieces in @otfdashkit/ui-native. They wrap Tamagui's
underlying types with OTF tokens and sane defaults.
Text
Themed text component with size + weight token slots.
<Text fontSize="$8" fontWeight="700" color="$color12">Hello</Text>
<Text fontSize="$4" color="$color11">Subtle subtitle</Text>Button
Native pressable button with variant + size slots.
<Button variant="solid" onPress={onSubmit}>Continue</Button>
<Button variant="outline" size="lg">Cancel</Button>
<Button variant="ghost" icon={<X />} circular />Variants: solid · outline · ghost · destructive.
Sizes: sm · md · lg.
Card
Themed card container with built-in padding tokens.
<Card padding="$4" elevate>
<Text fontSize="$6" fontWeight="700">Title</Text>
<Text color="$color11">Subtitle</Text>
</Card>Input
Single-line input with the kit's border + focus styling.
<Input
value={email}
onChangeText={setEmail}
placeholder="you@example.com"
keyboardType="email-address"
autoCapitalize="none"
/>Avatar
Circular avatar with image + initial fallback. Composable parts:
Avatar, Avatar.Image, Avatar.Fallback.
<Avatar circular size="$5">
<Avatar.Image src={user.avatarUrl} />
<Avatar.Fallback>{user.initials}</Avatar.Fallback>
</Avatar>OtfSwitch
The one OTF toggle (iOS proportions). Off: a 1.5px muted ring and a smaller white knob, so the state
reads at 3:1 on any card. On: the accent fills the track and the knob grows to full size. The knob
springs across and stretches while pressed; reduced motion jumps. It has a 44pt hit area, role
switch, aria-checked, and a focus ring on web (keyboard focus only; Space toggles).
<OtfSwitch checked={dark} onCheckedChange={setDark} accessibilityLabel="Dark mode" />
<OtfSwitch size="sm" checked={on} onCheckedChange={setOn} />| Prop | Default | Notes |
|---|---|---|
checked / defaultChecked / onCheckedChange | uncontrolled | Controlled when checked is set |
size | md | md 51x31, sm 40x24 for popovers and dense rows; $2-$4 still map |
activeColor | theme $color9 | On track and ring. Hex-token kits pass their primary |
inactiveColor | theme $color11 | Off ring. Must clear 3:1 on the card |
trackColor | theme $color2 | Off fill |
activeThumbColor | white, or ink on pale accents | Leave unset: white unless it would sit under 2:1 on the accent |
accessibilityLabel | none | Always set it: "Dark mode", "Push notifications" |
Kits with their own hex tokens keep a small themeSwitchColors(tokens) helper that returns
{ activeColor, inactiveColor, trackColor }, and spread it: <OtfSwitch {...themeSwitchColors(tokens)} />.
Never use the react-native Switch for a toggle: it renders as a thin pill on web.