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: packages/dev/s2-docs/pages/s2/styling.mdx
+6-24Lines changed: 6 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,29 +99,6 @@ import {Button} from '@react-spectrum/s2';
99
99
'visibility'
100
100
]} />
101
101
102
-
### UNSAFE Style Overrides
103
-
104
-
We highly discourage overriding the styles of React Spectrum components because it may break at any time when we change our implementation, making it difficult for you to update in the future. Consider using [React Aria Components](https://react-spectrum.adobe.com/react-aria/) with our `style` macro to build a custom component with Spectrum styles instead.
105
-
106
-
With that being said, the `UNSAFE_className` and `UNSAFE_style` props are supported on Spectrum 2 components as last-resort escape hatches.
The `style` macro supports a constrained set of values per property that conform to Spectrum 2. This improves consistency and maintainability. See the [reference](./styling/reference.html) page for a full list of available style macro properties.
@@ -148,6 +125,7 @@ Size props like `width` and `height` accept arbitrary pixel values. Values are c
148
125
### Typography
149
126
150
127
Spectrum 2 typography is applied via the `font` shorthand, which sets `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, and `color`. You can override any of these individually.
128
+
Note that you should always specify the `font` at the element level, setting it globally is insufficient since this will often differ per component.
151
129
152
130
```tsx
153
131
<main>
@@ -170,6 +148,10 @@ Type scales include: UI, Body, Heading, Title, Detail, and Code. Each scale has
170
148
</Content>
171
149
</InlineAlert>
172
150
151
+
### Breakpoints
152
+
153
+
The style macro has several predefined [breakpoints](./styling/reference.html#conditions), but you can use arbitrary CSS media or container queries as [conditional values](./styling/advanced.html#conditional-styles) in your style macro as well.
154
+
173
155
## CSS optimization
174
156
175
157
The `style` macro relies on CSS bundling and minification for optimal output. Follow these best practices:
@@ -238,7 +220,7 @@ in a non-atomic format, making it easier to scan.
238
220
the `style` macros for quick prototyping.
239
221
240
222
- If you are using Cursor, we offer a set of [Cursor rules](https://github.com/adobe/react-spectrum/blob/main/rules/style-macro.mdc) to use when developing with style macros. Additionally,
241
-
we have MCP servers for [React Aria](#TODO) and [React Spectrum](https://www.npmjs.com/package/@react-spectrum/mcp) respectively that interface with the docs.
223
+
we have MCP servers for [React Aria](../react-aria/mcp.html) and [React Spectrum](./mcp.html) respectively that interface with the docs.
The `iconStyle` macro should be used when styling Icons, see the [docs](../icons.html#iconstyle) for more information.
219
+
220
+
## UNSAFE Style Overrides
221
+
222
+
We highly discourage overriding the styles of React Spectrum components because it may break at any time when we change our implementation, making it difficult for you to update in the future. Consider using [React Aria Components](https://react-spectrum.adobe.com/react-aria/) with our `style` macro to build a custom component with Spectrum styles instead.
223
+
224
+
With that being said, the `UNSAFE_className` and `UNSAFE_style` props are supported on Spectrum 2 components as last-resort escape hatches.
0 commit comments