component in React, which allows for the addition of inline CSS stylesheets to a document. It details the usage, props, and special rendering behaviors of the
_style_ – React
_style_ – React
v19
<style>
The built-in browser <style> component lets you add inline CSS
stylesheets to your document.
Reference
<style>
Usage
Reference
<style>
To add inline styles to your document, render the built-in browser <style>
component. You can render <style> from any component and React will in
certain cases place the corresponding DOM element in the document head
and de-duplicate identical styles.
Props
https://react.dev/reference/react-dom/components/style 1/5
20/02/2025, 18:32 <style> – React
precedence : a string. Tells React where to rank the <style> DOM node
relative to others in the document <head> , which determines which
stylesheet can override the other. React will infer that precedence values
it discovers first are “lower” and precedence values it discovers later are
“higher”. Many style systems can work fine using a single precedence
value because style rules are atomic. Stylesheets with the same
precedence go together whether they are <link> or inline <style> tags
or loaded using preinit functions.
href : a string. Allows React to de-duplicate styles that have the same
href .
To opt into this behavior, provide the href and precedence props. React will
de-duplicate styles if they have the same href . The precedence prop tells
React where to rank the <style> DOM node relative to others in the
document <head> , which determines which stylesheet can override the
other.
React will ignore changes to props after the style has been rendered.
(React will issue a warning in development if this happens.)
https://react.dev/reference/react-dom/components/style 2/5
20/02/2025, 18:32 <style> – React
React may leave the style in the DOM even after the component that
rendered it has been unmounted.
Usage
The href prop should uniquely identify the stylesheet, because React will
de-duplicate stylesheets that have the same href .
If you supply a precedence prop, React will reorder inline stylesheets based
on the order these values appear in the component tree.
Inline stylesheets will not trigger Suspense boundaries while they’re loading.
Even if they load async resources like fonts or images.
Show more
https://react.dev/reference/react-dom/components/style 3/5
20/02/2025, 18:32 <style> – React
PREVIOUS
<script>
NEXT
<title>
uwu?
Describing the UI
Adding Interactivity
Managing State
Escape Hatches
https://react.dev/reference/react-dom/components/style 4/5
20/02/2025, 18:32 <style> – React
Community More
Acknowledgements Terms
https://react.dev/reference/react-dom/components/style 5/5