# Radix Themes Native Documentation > A React Native port of Radix Themes - An open-source component library optimized for fast development, easy maintenance, and accessibility. ## Installation ```bash npm install radix-native-ui ``` ## Peer Dependencies - `react` >= 18 - `react-native` >= 0.70 - `expo` >= 48 ## Quick Start ```tsx import { ThemeProvider, Button, Text, Flex, Card, Heading } from 'radix-native-ui'; export default function App() { return ( Welcome Build beautiful mobile apps with Radix Themes Native. ); } ``` --- ## ThemeProvider Wrap your app with ThemeProvider to enable theming. ### Props #### Theme Configuration | Prop | Type | Default | Description | |------|------|---------|-------------| | `accentColor` | `Color` | `'indigo'` | Primary accent color for the theme | | `grayColor` | `'mauve' \| 'olive' \| 'sage' \| 'sand' \| 'slate' \| 'gray'` | `'mauve'` | Gray scale color | | `radius` | `'none' \| 'small' \| 'medium' \| 'large' \| 'full'` | `'medium'` | Border radius scale | | `scaling` | `number` | `1` | Overall scaling factor (1 = 100%) | | `panelBackground` | `'solid' \| 'translucent'` | `'solid'` | Panel background style | #### Runtime Behavior | Prop | Type | Default | Description | |------|------|---------|-------------| | `appearance` | `'light' \| 'dark' \| 'inherit'` | `'inherit'` | Color scheme preference. Use 'inherit' to follow device/parent settings | | `forcedMode` | `'light' \| 'dark'` | `undefined` | Force a specific mode, overriding device and parent settings | | `hasBackground` | `boolean` | `true` | Whether to apply background color | | `onModeChange` | `(mode: 'light' \| 'dark') => void` | `undefined` | Callback when theme mode changes | #### Legacy Support | Prop | Type | Default | Description | |------|------|---------|-------------| | `themeOptions` | `Partial` | `undefined` | Theme options object (legacy - use flat props instead). Flat props take precedence | #### Toast Configuration | Prop | Type | Default | Description | |------|------|---------|-------------| | `toastConfig` | `ToastConfig` | `undefined` | Configuration options for toast notifications | ### Available Accent Colors `amber`, `blue`, `bronze`, `brown`, `crimson`, `cyan`, `gold`, `grass`, `green`, `indigo`, `iris`, `jade`, `lime`, `mint`, `orange`, `pink`, `plum`, `purple`, `red`, `ruby`, `sky`, `teal`, `tomato`, `violet`, `yellow` ### Gray Scale Variants `gray`, `mauve`, `olive`, `sage`, `sand`, `slate` --- ## Hooks ### useTheme Returns the current theme object. ```tsx const theme = useTheme(); // Returns: Theme object with colors, typography, spacing, etc. ``` ### useThemeMode Returns the current theme mode. ```tsx const mode = useThemeMode(); // Returns: 'light' | 'dark' ``` ### useThemeActions Returns theme actions and current mode. ```tsx const { setMode, toggleMode, mode } = useThemeActions(); // setMode: (mode: ThemeMode) => void // toggleMode: () => void // mode: ThemeMode ``` --- ## Components ### Layout Components #### Box Primitive container with styling props. ```tsx Content ``` #### Flex Flexbox layout component. ```tsx Left Right ``` **Props:** - `direction`: `'row' | 'column' | 'row-reverse' | 'column-reverse'` - `align`: `'start' | 'center' | 'end' | 'stretch' | 'baseline'` - `justify`: `'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'` - `wrap`: `'wrap' | 'nowrap' | 'wrap-reverse'` - `gap`: `number` (uses theme scale) #### Grid Grid layout component. ```tsx Item 1 Item 2 Item 3 ``` #### Container Responsive container with max-width. ```tsx Content ``` #### Inset Padding component with overflow clipping. ```tsx ``` --- ### Typography Components #### Text ```tsx Text content ``` **Props:** - `size`: `1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9` (default: 3) - `weight`: `'light' | 'regular' | 'medium' | 'bold'` - `align`: `'left' | 'center' | 'right'` - `color`: `string` - `truncate`: `boolean` #### Heading ```tsx Heading ``` **Props:** - `size`: `1 | 2 | 3 | 4 | 5` (default: 3) - `weight`: `'light' | 'regular' | 'medium' | 'bold'` #### Strong, Em, Code, Kbd ```tsx Bold text Italic text const x = 42; Cmd + C ``` --- ### Form Components #### Button ```tsx ``` **Props:** - `variant`: `'classic' | 'solid' | 'soft' | 'outline' | 'ghost'` (default: 'classic') - `size`: `1 | 2 | 3` (default: 2) - `color`: `string` (accent color name) - `disabled`: `boolean` - `loading`: `boolean` - `highContrast`: `boolean` - `onPress`: `(event: GestureResponderEvent) => void` - `width`: `number | string` #### TextField ```tsx ``` **Props:** - `value`: `string` - `onChangeText`: `(text: string) => void` - `placeholder`: `string` - `variant`: `'classic' | 'surface' | 'soft'` - `size`: `1 | 2 | 3` - `disabled`: `boolean` - `error`: `string` - `secureTextEntry`: `boolean` #### Checkbox ```tsx ``` #### Switch ```tsx ``` #### RadioGroup ```tsx Option 1 Option 2 ``` #### Select ```tsx