Skip to main content
Documentation
On this page

Install Cirth for Qwik

A Qwik City app imports its global stylesheet from src/root.tsx. Cirth is one import there, and Qwik's build, on Vite 7, keeps its light-dark() colours as they are.

Verified with Qwik 1.20.1 on

Three steps: install, import it and check it.

1 Install #

Package manager
npm install @cirthcss/cirth
pnpm add @cirthcss/cirth
yarn add @cirthcss/cirth
bun add @cirthcss/cirth

2 Import it #

At the top of src/root.tsx, before the starter's global.css:

import "@cirthcss/cirth";
import { component$ } from "@builder.io/qwik";
import { QwikCityProvider, RouterOutlet } from "@builder.io/qwik-city";
import { RouterHead } from "./components/router-head/router-head";

import "./global.css";

3 Check it #

Put this forced-dark region in a page or component that uses the global stylesheet:

<section data-theme="dark">
  <article>
    <p>Dark, whatever the system scheme is.</p>
  </article>
</section>

Run the app, then open the page while the system uses a light theme. A dark article proves that Cirth loaded and that data-theme="dark" is working. It remains dark when the system switches to a dark theme.

Customization covers the --cirth-* properties; set yours in global.css. Package and builds lists the classless, scoped and print entry points. Return to Framework guides for another stack.

Search documentation

Type at least two characters to search.