10
10
- [ Motivation] ( #motivation )
11
11
- [ Installation & Usage] ( #installation-&-usage )
12
12
- [ Base components] ( #base-components )
13
- - [ DOM components] ( #dom-components )
14
- - [ Composite components] ( #composite-components )
13
+ - [ Custom composite components as bases] ( #custom-composite-components-as-bases )
15
14
- [ Variants] ( #variants )
16
- - [ Named variants] ( #named-variants )
17
- - [ Variants controlled with JS expression] ( #variants-controlled-with-js-expression )
15
+ - [ Prop variants] ( #prop-variants )
18
16
- [ TODO] ( #todo )
19
17
20
18
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -67,7 +65,7 @@ And consume them like regular React components:
67
65
``` js
68
66
import {Label } from ' ./styles.react.css'
69
67
70
- < Label / > // => <div className ="<autogenerated classname>">...</div>
68
+ < Label / > // => <div class ="<autogenerated classname>">...</div>
71
69
```
72
70
73
71
## Base components
@@ -84,6 +82,14 @@ FancyButton {
84
82
}
85
83
```
86
84
85
+ Now ` <FancyButton /> ` renders into ` <button /> ` :
86
+
87
+ ``` js
88
+ import {FancyButton } from ' ./styles.react.css'
89
+
90
+ < FancyButton / > // => <button class="<autogenerated classname>">...</button>
91
+ ```
92
+
87
93
### Composite components
88
94
89
95
In fact any React components which accepts ` className ` props can be used as a
@@ -106,6 +112,7 @@ Variants is a mechanism which allows to define styling variants for a component.
106
112
### Named variants
107
113
108
114
You can define additional styling variants for your components:
115
+
109
116
``` css
110
117
Label {
111
118
color : red ;
@@ -118,6 +125,7 @@ Label:emphasis {
118
125
119
126
They are compiled as CSS classes which then can be controlled from JS via
120
127
` variant ` prop:
128
+
121
129
``` js
122
130
< Label variant= {{emphasis: true }} / > // sets both classes with `color` and `font-weight`
123
131
```
0 commit comments