File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,32 @@ export default props => (
146
146
)
147
147
```
148
148
149
+ ## Child Selectors
150
+
151
+ In some cases you might want to apply styles to children of the current element.
152
+ You can do so with Emotion's [ nested selectors] ( https://emotion.sh/docs/nested ) .
153
+
154
+ If you want to reference the current class of the component, you can use the [ ` & ` ] ( https://emotion.sh/docs/object-styles#child-selectors ) symbol.
155
+
156
+ ``` jsx
157
+ /** @jsx jsx */
158
+ import { jsx } from ' theme-ui'
159
+
160
+ export default props => (
161
+ < div
162
+ {... props}
163
+ sx= {{
164
+ h1: {
165
+ backgroundColor: ' tomato'
166
+ },
167
+ ' & > div' : {
168
+ fontSize: [2 , 3 , 4 ]
169
+ }
170
+ }}
171
+ / >
172
+ )
173
+ ```
174
+
149
175
## Raw CSS
150
176
151
177
To opt-out of using theme-based CSS, use the ` css ` prop to render raw CSS values.
You can’t perform that action at this time.
0 commit comments