|
10 | 10 |
|
11 | 11 | Provides a way to styling components in React Native with better experience and composability. The key feature is the ability to create multi-variants styles with a type-safe definition inspired by [Stitches](https://stitches.dev/docs/variants) and [CVA](https://cva.style/docs/getting-started/variants) (for React apps).
|
12 | 12 |
|
13 |
| -#### Available properties: |
| 13 | +## Features |
14 | 14 |
|
15 |
| -- `base`: The base styles for the element. |
16 |
| -- `variants`: The different visual styles for the element. |
17 |
| -- `compoundVariants`: Styles that apply when multiple other variant conditions are met. |
18 |
| -- `defaultVariants`: Set a variant by default when no variant is provided. |
| 15 | +- 🎨 Token-based styling system |
| 16 | +- 🧩 Variant API for conditional styling |
| 17 | +- 🔄 Compound variants for complex style combinations |
| 18 | +- 🧠 Type-safe with full TypeScript support |
| 19 | +- 🏎️ Lightweight and performant |
| 20 | +- 🧪 Fully tested |
19 | 21 |
|
20 | 22 | #### Roadmap
|
21 | 23 |
|
@@ -81,6 +83,13 @@ export const { sva, tokens } = defineTokens({
|
81 | 83 |
|
82 | 84 | After the tokens are defined, you can use the design tokens in your components. You'll be importing the `sva` function from the `jacaranda.config.ts` file.
|
83 | 85 |
|
| 86 | +#### Available properties: |
| 87 | + |
| 88 | +- `base`: The base styles for the element. |
| 89 | +- `variants`: The different visual styles for the element. |
| 90 | +- `compoundVariants`: Styles that apply when multiple other variant conditions are met. |
| 91 | +- `defaultVariants`: Set a variant by default when no variant is provided. |
| 92 | + |
84 | 93 | ```tsx
|
85 | 94 | // Button.tsx
|
86 | 95 | import { TouchableOpacity } from 'react-native';
|
@@ -125,6 +134,29 @@ const buttonStyles = sva({
|
125 | 134 | });
|
126 | 135 | ```
|
127 | 136 |
|
| 137 | +### Styled Components with Design Tokens |
| 138 | + |
| 139 | +Jacaranda provides a `styled` function similar to `styled-components` that allows you to create styled React Native components with access to your design tokens. |
| 140 | + |
| 141 | +#### Key features: |
| 142 | + |
| 143 | +- Create reusable styled components from any React Native component |
| 144 | +- Access design tokens using the `$` prefix (e.g. `$colors.primary50`) |
| 145 | +- Supports all React Native style properties |
| 146 | + |
| 147 | +```tsx |
| 148 | +import { View } from 'react-native'; |
| 149 | +import { styled } from './jacaranda.config'; |
| 150 | + |
| 151 | +const StyledView = styled(View)({ |
| 152 | + backgroundColor: '$colors.primary50', |
| 153 | +}); |
| 154 | + |
| 155 | +export const Screen = () => { |
| 156 | + return <StyledView></StyledView>; |
| 157 | +}; |
| 158 | +``` |
| 159 | + |
128 | 160 | ### TypeScript
|
129 | 161 |
|
130 | 162 | #### Extract variants from a component
|
|
0 commit comments