Style
Registers a <style> with the given CSS text.
Registers a <style> with the given CSS text. A key makes it replace an earlier style with the
same key; without one, every style stays.
Import#
ts
import { Style } from "@shadow-js/web";
Signature#
ts
function Style(props: StyleProps): null
Parameters#
| Name | Description |
|---|---|
props |
The CSS as children, an optional key, and attributes such as media. |
Returns#
Always null: nothing is rendered in place.
Throws#
- TypeError (production message
SHADOW_HEAD_KEY) whenkeyis not a non-empty string.
Examples#
ts
import { Style } from "@shadow-js/web";
function Theme() {
return <Style key="theme">{"body { margin: 0 }"}</Style>;
}