Meta reference

Style

Edit this page

Style adds a <style> element for CSS rules that apply to the document.


Import

import { Style } from "@solidjs/meta";

Type

const Style: Component<JSX.StyleHTMLAttributes<HTMLStyleElement>>;

Props

Accepts attributes for <style>.

children

  • Type: JSX.Element
  • Optional: Yes

Content rendered inside the style element.


Behavior

  • Registers a style tag with close: true.
  • Non-cascading tags can add one document-head element per active instance.
  • Requires MetaProvider in the component tree.

Examples

Basic usage

import { MetaProvider, Style } from "@solidjs/meta";
export default function Root() {
return (
<MetaProvider>
<Style>{`
p {
color: #26b72b;
}
`}</Style>
</MetaProvider>
);
}

Report an issue with this page