Web Only Features
Unistyles comes with some web only features which are not available on React Native side.
Web Styles
In Unistyles you can use web specific styles for your web app under _web
key.
Under _web
key you can pass any valid CSS Property and value that matches CSSProperties
type from React.
Keep in mind that under _web
you can’t use React Native specific styles.
transform
property on the web should be a string:
You can also use variants, breakpoints and other Unistyles features under the _web
key!
Pseudo elements
Unistyles also introduces you with a way to use pseudo elements and selectors in your web styles.
Every pseudo element and selector is included under the _web
key. As you can see :
& ::
were replaced with _
for easier usage.
Injecting custom classNames
If you want to write some part of your app with plain CSS you can add custom classNames to your styles.
_classNames
key under the _web
key will be injected to the DOM element as a className. You can pass string or array of strings into it.
Or pass them conditionally with dynamic functions: