Skip to content



    It's possible to use any existing CSS-in-JS solution.The simplest one is inline styles:

    function HiThere() {
      return <p style={{ color: 'red' }}>hi there</p>;
    export default HiThere;

    We bundle styled-jsx to provide support for isolated scoped CSS. The aim is to support "shadow CSS" similar to Web Components, which unfortunately do not support server-rendering and are JS-only.

    See the above examples for other popular CSS-in-JS solutions (like Styled Components).

    A component using styled-jsx looks like this:

    function HelloWorld() {
      return (
          Hello world
          <style jsx>{`
            p {
              color: blue;
            div {
              background: red;
            @media (max-width: 600px) {
              div {
                background: blue;
          <style global jsx>{`
            body {
              background: black;
    export default HelloWorld;

    Please see the styled-jsx documentation for more examples.

    Disabling JavaScript

    Yes, if you disable JavaScript the CSS will still be loaded in the production build (next start). During development, we require JavaScript to be enabled to provide the best developer experience with Fast Refresh.

    Was this helpful?