radix-native-ui 0.1.0-alpha.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # radix-native-ui
2
2
 
3
- Radix Themes for React Native and Expo. A port of the popular `radix-native-ui` component library to support mobile development with React Native.
3
+ Radix Themes for React Native and Expo. A port of the popular Radix Themes component library to support mobile development with React Native.
4
+
5
+ > **Documentation**: https://copylabs.mintlify.app
4
6
 
5
7
  ## Installation
6
8
 
@@ -16,10 +18,9 @@ pnpm add radix-native-ui
16
18
 
17
19
  This package requires the following peer dependencies:
18
20
 
21
+ - `expo` >= 48
19
22
  - `react` >= 18
20
23
  - `react-native` >= 0.70
21
- - `@radix-ui/react-slot` >= 1.0.0
22
- - `react-native-safe-area-context` >= 4.0.0 (optional, for safe area support)
23
24
 
24
25
  ## Usage
25
26
 
@@ -91,24 +92,28 @@ function MyComponent() {
91
92
  ### Typography Components
92
93
 
93
94
  - **Text** - Versatile text component with size, weight, color props
94
- - **Heading** - Semantic heading component (h1-h5)
95
+ - **Heading** - Semantic heading component (h1-h6)
95
96
  - **Strong** - Bold text
96
97
  - **Em** - Italic text
97
98
  - **Code** - Inline code styling
98
- - **Kbd** - Keyboard shortcut styling
99
+ - **Kbd** - Keyboard shortcut styling with size support (1-9)
99
100
  - **Blockquote** - Quote block styling
100
101
  - **Link** - Pressable link component
101
102
 
102
103
  ### Form Components
103
104
 
104
- - **Button** - Interactive button with variants (classic, solid, soft, outline, ghost)
105
- - **IconButton** - Button with icon support
105
+ - **Button** - Interactive button with variants (classic, solid, soft, outline, ghost) and haptic feedback
106
+ - **IconButton** - Button with icon support and haptic feedback
106
107
  - **TextField** - Text input component
107
108
  - **TextArea** - Multi-line text input
108
- - **Switch** - Toggle switch component
109
- - **Radio** - Radio button component
110
- - **RadioGroup** - Group of radio buttons
111
- - **Select** - Dropdown select component
109
+ - **Switch** - Toggle switch component with haptic feedback
110
+ - **Radio** - Radio button component with haptic feedback
111
+ - **RadioGroup** - Compound component pattern (RadioGroup.Root, RadioGroup.Item)
112
+ - **RadioCards** - Card-style radio selection with haptic feedback and press animations
113
+ - **Checkbox** - Checkbox component with haptic feedback
114
+ - **CheckboxCards** - Card-style checkbox selection with haptic feedback and press animations
115
+ - **Select** - Dropdown select component with haptic feedback
116
+ - **Slider** - Slider component
112
117
 
113
118
  ### Data Display Components
114
119
 
@@ -188,6 +193,11 @@ import { Text, Heading, Code, Kbd } from 'radix-native-ui';
188
193
  // Code and Kbd
189
194
  <Code>const value = 42;</Code>
190
195
  <Kbd>Cmd + C</Kbd>
196
+
197
+ // Kbd with sizes
198
+ <Kbd size={1}>Small</Kbd>
199
+ <Kbd size={3}>Medium</Kbd>
200
+ <Kbd size={5}>Large</Kbd>
191
201
  ```
192
202
 
193
203
  ## Example: Layout with Box and Flex
@@ -212,11 +222,6 @@ import { Box, Flex, Grid, Container } from 'radix-native-ui';
212
222
  <Box>Item 2</Box>
213
223
  <Box>Item 3</Box>
214
224
  </Grid>
215
-
216
- // Responsive container
217
- <Container size={3} responsive>
218
- <Text>Centered content with max-width</Text>
219
- </Container>
220
225
  ```
221
226
 
222
227
  ## Theming Guide
@@ -283,45 +288,45 @@ const typography = {
283
288
  };
284
289
  ```
285
290
 
286
- ## Migration Guide from Web Radix Themes
291
+ ## Documentation
287
292
 
288
- ### Key Differences
293
+ For full documentation, examples, and API references, visit:
289
294
 
290
- 1. **No CSS-in-JS** - React Native uses StyleSheet instead of CSS
291
- 2. **Box Model** - Use `padding` and `margin` props instead of CSS shorthand
292
- 3. **Colors** - Color scales are arrays, not CSS variables
293
- 4. **Responsive** - Media queries work differently in React Native
295
+ **https://copylabs.mintlify.app**
294
296
 
295
- ### Web to Native Mapping
297
+ ## Migration from Web Radix Themes
296
298
 
297
- ```tsx
298
- // Web Radix Themes
299
- <Box css={{ p: '$4', bg: '$gray2' }} />
299
+ If you're familiar with Radix Themes for web, here are the key differences for React Native:
300
300
 
301
- // React Native (our package)
302
- <Box padding={4} backgroundColor="gray.2" />
303
- ```
301
+ ### Key Differences
304
302
 
305
- ### Common Props Mapping
303
+ 1. **No CSS-in-JS** - React Native uses StyleSheet instead of CSS
304
+ 2. **Box Model** - Use `padding` and `margin` props with theme scale values
305
+ 3. **Colors** - Color scales are arrays (e.g., `gray[5]`), not CSS variables
306
+ 4. **Event Handlers** - Use `onPress` instead of `onClick`
306
307
 
307
- | Web CSS | React Native |
308
- |---------|-------------|
309
- | `display: flex` | `display="flex"` |
310
- | `flexDirection: row` | `flexDirection="row"` |
311
- | `justifyContent: center` | `justifyContent="center"` |
312
- | `alignItems: center` | `alignItems="center"` |
313
- | `gap: 16` | `gap={4}` (uses theme scale) |
314
- | `padding: 20` | `padding={5}` (uses theme scale) |
315
- | `backgroundColor: #fff` | `backgroundColor="#ffffff"` or `backgroundColor="gray.1"` |
308
+ ### API Differences
316
309
 
317
- ### Event Handlers
310
+ | Web Radix Themes | React Native (radix-native-ui) |
311
+ |------------------|-------------------------------|
312
+ | `css={{ p: '$4' }}` | `padding={4}` |
313
+ | `variant="solid"` | `variant="solid"` (same) |
314
+ | `size="2"` | `size={2}` (number, not string) |
315
+ | `onClick` | `onPress` |
316
+ | `color="red"` | `color="red"` (same) |
318
317
 
319
- ```tsx
320
- // Web: onClick
321
- <Button onClick={handleClick} />
318
+ ### Usage Example
322
319
 
323
- // React Native: onPress
324
- <Button onPress={handlePress} />
320
+ ```tsx
321
+ // Web Radix Themes
322
+ <Button variant="solid" size="2" onClick={handleClick}>
323
+ Click me
324
+ </Button>
325
+
326
+ // React Native (radix-native-ui)
327
+ <Button variant="solid" size={2} onPress={handlePress}>
328
+ Click me
329
+ </Button>
325
330
  ```
326
331
 
327
332
  ## Testing
@@ -339,9 +344,43 @@ npm test -- --coverage
339
344
  npm test -- Box.test.tsx
340
345
  ```
341
346
 
347
+ ## Haptics & Animations
348
+
349
+ Many interactive components include built-in haptic feedback and press animations for a native feel:
350
+
351
+ ### Components with Haptic Feedback
352
+
353
+ - **Button** - Haptic feedback on press (configurable via `hapticFeedback` prop)
354
+ - **IconButton** - Haptic feedback on press
355
+ - **Switch** - Haptic feedback when toggled
356
+ - **Radio** - Haptic feedback when selected
357
+ - **RadioCards** - Haptic feedback when selection changes
358
+ - **Checkbox** - Haptic feedback when toggled
359
+ - **CheckboxCards** - Haptic feedback when selection changes
360
+ - **Select** - Haptic feedback on item selection
361
+
362
+ ### Press Animations
363
+
364
+ Interactive components use `AnimatedPressable` for consistent press animations:
365
+ - Scale down to 0.97x on press
366
+ - Opacity change to 0.9 on press
367
+ - 100ms animation duration
368
+ - Native driver for 60fps performance
369
+
370
+ ```tsx
371
+ // Disable haptic feedback if needed
372
+ <Button hapticFeedback={false}>No Haptic</Button>
373
+
374
+ // RadioCards with haptics
375
+ <RadioCards.Root value={value} onValueChange={setValue}>
376
+ <RadioCards.Item value="1">Option 1</RadioCards.Item>
377
+ <RadioCards.Item value="2" hapticFeedback={false}>No Haptic</RadioCards.Item>
378
+ </RadioCards.Root>
379
+ ```
380
+
342
381
  ## Performance
343
382
 
344
- All components are optimized with React.memo() and useMemo/useCallback hooks to minimize unnecessary re-renders. Custom areEqual functions are provided for complex components to ensure optimal performance.
383
+ All components are optimized to minimize unnecessary re-renders.
345
384
 
346
385
  ## Contributing
347
386
 
@@ -350,3 +389,7 @@ Contributions are welcome! Please read our contributing guidelines in the main r
350
389
  ## License
351
390
 
352
391
  MIT
392
+
393
+ ---
394
+
395
+ **[View Documentation](https://copylabs.mintlify.app)** | **[GitHub](https://github.com/Copy-Labs/radix-native-ui)**