diff --git a/.storybook-s2/docs/Icons.jsx b/.storybook-s2/docs/Icons.jsx index af7554dc0cc..d16eec4f0c6 100644 --- a/.storybook-s2/docs/Icons.jsx +++ b/.storybook-s2/docs/Icons.jsx @@ -6,7 +6,7 @@ import {highlight} from './highlight' with {type: 'macro'}; export function Icons() { return ( -
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 with our style macro to build a custom component with Spectrum styles instead.
-That said, just like in React Spectrum v3, the UNSAFE_className
and UNSAFE_style
props are supported on Spectrum 2 components as last-resort escape hatches. However, unlike in v3, UNSAFE_classNames must be placed in a special UNSAFE_overrides
CSS cascade layer. This guarentees that your overrides will always win over other styles on the page, no matter the order or specificity of the selector.
That said, just like in React Spectrum v3, the UNSAFE_className
and UNSAFE_style
props are supported on Spectrum 2 components as last-resort escape hatches.
{highlight(`/* YourComponent.tsx */ import {Button} from '@react-spectrum/s2'; import './YourComponent.css'; @@ -237,12 +237,10 @@ function YourComponent() { return ; }`)}
{highlight(`/* YourComponent.css */ -@layer UNSAFE_overrides { - /* Wrap all UNSAFE_className rules in this layer. */ - .your-unsafe-class { - background: red; - } -}`, 'CSS')}+.your-unsafe-class { + background: red; +} +`, 'CSS')}