You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/foundation/assets.md
+8-9
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,19 @@ sidebar_label: Assets
4
4
title: "Assets"
5
5
---
6
6
7
-
Assets are a big part of the whole UI system, whether it's an icon, placeholder or an illustration, we use them everywhere.
8
-
Load groups of assets and easily render them with the _Image_ component.
7
+
Assets are fundamental building blocks in UI systems, encompassing icons, placeholders, and illustrations that enhance the user interface. The Assets system allows you to efficiently manage and render these resources using the _Image_ component.
9
8
10
9
```javascript
11
10
import {Assets, Image} from'react-native-ui-lib';
12
11
12
+
// Load a simple asset group
13
13
Assets.loadAssetsGroup('icons', {
14
14
icon1:require('icon1.png'),
15
15
icon2:require('icon2.png'),
16
16
icon3:require('icon3.png'),
17
17
});
18
18
19
-
//or as a nested group to create your own hierarchy
19
+
//Load nested asset groups for better organization
Design Tokens are contextual colors based on the system colors.
20
-
The design token name structure is "$[property]-[semantic]-[weight]". (e.g $backgroundPrimaryHeavy, $textSuccessLight)
19
+
Design Tokens provide semantic meaning to our color system by mapping contextual usage to system colors.
20
+
Each token follows the naming pattern: `$[property][Semantic][Weight]`
21
21
22
-
<ColorsTable />
22
+
For example:
23
+
-`$backgroundPrimaryHeavy`: A heavy primary background color
24
+
-`$textSuccess`: Success-themed text color
25
+
-`$iconWarning`: Warning-themed icon color
23
26
24
-
-**Property** - The property we use this token for. The properties are:
27
+
### Design Token Structure
25
28
26
-
-`background`
27
-
-`text`
28
-
-`icon`
29
-
-`outline`
29
+
Design tokens follow a structured naming convention: `$[property][Semantic][Weight]`, where:
30
30
31
-
-**Semantic** - the meaning of the color, what is the message that we want to pass using this color. The semantics are:
31
+
#### Property
32
+
Defines the UI element the token applies to:
33
+
-`background` - Background colors
34
+
-`text` - Text colors
35
+
-`icon` - Icon colors
36
+
-`outline` - Border/outline colors
32
37
33
-
-`neutral`
34
-
-`primary` - the primary color of the app, means, blue for Spaces app and green for Fit app.
35
-
-`general`
36
-
-`success`
37
-
-`warning`
38
-
-`danger`
39
-
-`disabled`
40
-
-`inverted`
41
-
-`default`
38
+
#### Semantic
39
+
Represents the contextual meaning:
40
+
-`neutral` - Neutral/default state
41
+
-`primary` - App's primary brand color
42
+
-`general` - General purpose
43
+
-`success` - Positive/success states
44
+
-`warning` - Warning/caution states
45
+
-`danger` - Error/danger states
46
+
-`disabled` - Disabled state
47
+
-`inverted` - Reversed/contrasting colors
48
+
-`default` - Default state
42
49
43
-
-**Weight** - the weight of the color (optional). The weights are:
44
-
-`light`
45
-
-`medium`
46
-
-`heavy`
50
+
#### Weight (Optional)
51
+
Indicates the color intensity:
52
+
-`light` - Lighter variation
53
+
-`medium` - Medium intensity
54
+
-`heavy` - Heavier/darker variation
47
55
48
-
So, for example, a valid token can be: `$backgroundPrimaryHeavy` or `$textSuccess`.
49
-
A full list of our design tokens can be found here -
56
+
Examples:
57
+
-`$backgroundPrimaryHeavy` - Dark variant of primary background
58
+
-`$textSuccess` - Success state text color
59
+
-`$iconWarning` - Warning state icon color
50
60
51
-
### Dark Mode Support
61
+
View all available design tokens in our [token definition files](https://github.com/wix/react-native-ui-lib/blob/master/src/style/designTokens.ts).
52
62
53
-
By using design tokens, your getting dark mode support out of the box!
54
-
Each token is mapped to a single system color in light mode and to a (usually different) single system color in dark mode.
55
-
For example, `$textSuccess` is mapped to `green10` in light (deafult) mode, and to `green60` in dark mode.
56
-
All the design tokens and their mapping in light mode can be found [here](https://github.com/wix/react-native-ui-lib/blob/master/src/style/designTokens.ts), dark mode mapping can be found [here](https://github.com/wix/react-native-ui-lib/blob/master/src/style/designTokensDM.ts).
63
+
<ColorsTable />
57
64
58
-
### Add Your Own Design Tokens
59
65
60
-
Adding or overriding your own design tokens can be done by using the [loadSchemes](https://wix.github.io/react-native-ui-lib/docs/foundation/colors#loadschemes) method.
61
-
To generate the design tokens, based on your app primary color and load them automatically into the `Colors` object, use:
66
+
### Dark Mode Integration
67
+
68
+
Design tokens provide seamless dark mode support through automatic color mapping. Each token maps to appropriate system colors for both light and dark themes:
Copy file name to clipboardExpand all lines: docs/foundation/modifiers.md
+121-60
Original file line number
Diff line number
Diff line change
@@ -4,29 +4,32 @@ sidebar_label: Modifiers
4
4
title: "Modifiers"
5
5
---
6
6
7
-
As you have probably noticed already, we translate our style presets into modifiers.
8
-
**Modifiers** help you create a stunning UI easily and quickly.
9
-
10
-
**[!IMPORTANT]**
11
-
Make sure to use modifiers only on UILib components, as some modifiers can cause issues on Android when used on React Native components directly.
7
+
Discover the power of our style presets transformed into modifiers.
8
+
**Modifiers** are a powerful tool designed to streamline UI development, making it both efficient and elegant.
12
9
13
10
## Layout Modifiers
14
-
Use our alignment properties to quickly position the content of your view without getting confused calculating all those flex rules.
15
-
- flex - apply `flex:1` on a view
16
-
- flex-[value] - When you want to control the flex value
17
-
- flexS - FlexShrink
18
-
- flexG - FlexGrow
19
-
- left
20
-
- top
21
-
- right
22
-
- bottom
23
-
- row - change direction to row (default is column)
24
-
- center
25
-
- centerH - center content horizontally
26
-
- centerV - center content vertically
27
-
- spread - spread content (similar to `space-between`)
28
-
29
-
! Notice that the layout modifiers affect the View's children
11
+
Streamline your layout design with our intuitive alignment properties. These modifiers simplify view positioning without the complexity of manual flex calculations.
12
+
13
+
### Basic Flex Properties
14
+
-`flex` - Apply `flex: 1` to expand a view
15
+
-`flex-[value]` - Set a specific flex value
16
+
-`flexS` - Enable flex shrink
17
+
-`flexG` - Enable flex grow
18
+
19
+
### Alignment Properties
20
+
-`left` - Align content to the left
21
+
-`right` - Align content to the right
22
+
-`top` - Align content to the top
23
+
-`bottom` - Align content to the bottom
24
+
-`center` - Center content both horizontally and vertically
25
+
-`centerH` - Center content horizontally
26
+
-`centerV` - Center content vertically
27
+
28
+
### Layout Direction
29
+
-`row` - Set flex direction to row (default is column)
30
+
-`spread` - Distribute content evenly (equivalent to `space-between`)
31
+
32
+
> Note: Layout modifiers affect the positioning of the View's children elements
30
33
31
34
```jsx
32
35
<View flex left>
@@ -52,68 +55,126 @@ Use our alignment properties to quickly position the content of your view withou
{/* Content with top margin of 5 and bottom margin of 10 */}
89
+
</View>
78
90
```
79
91
80
-
! padding and margin modifiers can also take [Spacing](https://github.com/wix/react-native-ui-lib/blob/master/src/style/spacings.ts) constants.
92
+
### Gap Modifiers
93
+
Control the spacing between child elements in a container:
94
+
-`gap-[value]` - Uniform gap between all children
95
+
96
+
```jsx
97
+
<View row gap-10>
98
+
<Button label="First"/>
99
+
<Button label="Second"/>
100
+
<Button label="Third"/>
101
+
</View>
102
+
```
103
+
104
+
These modifiers are particularly useful for creating evenly spaced layouts without manually adding margins to individual elements.
105
+
106
+
> **Note**: Spacing modifiers can use your app's predefined spacing presets for consistent design. These presets are defined in our `spacings.ts`[file](https://github.com/wix/react-native-ui-lib/blob/master/src/style/spacings.ts) and allow for uniform spacing patterns throughout your application.
107
+
108
+
81
109
```jsx
82
-
<View margin-s5 padding-s2>...</View>
110
+
<View margin-s5 padding-s2>
111
+
{/* Using preset spacing values */}
112
+
</View>
83
113
```
114
+
115
+
84
116
## Position Modifiers
85
-
Use the position modifiers to quickly set an absolute position for your views.
86
-
-`abs` will set the absolute position on your View
87
-
-`absL`, `absT`, `absR`, `absB` - set the absolute position and align to Left, Top, Right, Bottom accordingly
88
-
-`absH` and `absV` - position absolute and stretch horizontally or vertically
89
-
-`absF` will set the absolute position and fill the parent view (similar to StyleSheet.absoluteFillObject)
117
+
Easily control component positioning with our absolute position modifiers:
90
118
91
-
##Styling Modifiers
92
-
The last type of modifiers is for styling your components
119
+
### Basic Positioning
120
+
-`abs` - Apply absolute positioning to a component
93
121
94
-
-[colorKey] - Controls the color of text components
95
-
- background-[colorKey] (or bg-[colorKey]) - Background color
122
+
### Edge Alignment
123
+
-`absL` - Position absolutely and align to the left edge
124
+
-`absT` - Position absolutely and align to the top edge
125
+
-`absR` - Position absolutely and align to the right edge
126
+
-`absB` - Position absolutely and align to the bottom edge
127
+
128
+
### Stretch Options
129
+
-`absH` - Position absolutely and stretch horizontally
130
+
-`absV` - Position absolutely and stretch vertically
131
+
-`absF` - Position absolutely and fill the entire parent container (equivalent to `StyleSheet.absoluteFillObject`)
96
132
97
133
```jsx
98
-
<Text blue30>...</Text>
99
-
<View bg-grey70>...</View>
100
-
<TouchableOpacity bg-red30/>
134
+
<View absL>
135
+
<Text>Left-aligned absolute content</Text>
136
+
</View>
137
+
138
+
<View absF>
139
+
<Text>Full-screen absolute content</Text>
140
+
</View>
101
141
```
102
142
103
-
-[typographyKey] - Controls the typography of text components
143
+
## Style Modifiers
144
+
Enhance your components' visual appearance with our style modifiers:
145
+
146
+
### Color Modifiers
147
+
Apply colors to text and backgrounds:
148
+
-`[colorKey]` - Set text color (for Text components)
149
+
-`background-[colorKey]` or `bg-[colorKey]` - Set background color
0 commit comments