Skip to content

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} />
PropDefaultNotes
checked / defaultChecked / onCheckedChangeuncontrolledControlled when checked is set
sizemdmd 51x31, sm 40x24 for popovers and dense rows; $2-$4 still map
activeColortheme $color9On track and ring. Hex-token kits pass their primary
inactiveColortheme $color11Off ring. Must clear 3:1 on the card
trackColortheme $color2Off fill
activeThumbColorwhite, or ink on pale accentsLeave unset: white unless it would sit under 2:1 on the accent
accessibilityLabelnoneAlways 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.

See also

  • Interface — Headings, Dialog, Tabs, Tooltip, Badge, Icon
  • Layouts — Section, Grid, ScreenLayout, KeyboardStickyFooter

Free with your email

Get the free AI configs pack

The AI files every kit ships with. Drop them in and your AI tool knows your project.

  • CLAUDE.mdProject context
  • .cursorrulesRules for Cursor
  • prompts/Task prompts

No spam. Unsubscribe any time.