Theming

InstallationCustomization

Customize colors, radius and fonts with CSS variables.

Everything in Krz-ui is driven by CSS variables. Override them anywhere — globally or on any wrapper.

CSS variables

globals.css
:root {
  --krz-primary: #0ea5e9;
  --krz-radius: 8px;
  --krz-font: "Poppins", sans-serif;
}

Brand color

--krz-primary is the only variable you need to change. The hover shade, gradient, soft tint, text and border shades, focus ring and the text drawn on top of the color are all worked out from it, in light and dark mode.

To fine-tune a single shade, set it yourself and it replaces the derived one:

globals.css
:root {
  --krz-primary: #0ea5e9;
  --krz-primary-text: #0369a1; /* optional: your own shade for brand-colored text */
}

To use a different brand color in one part of the page, set --krz-primary on a wrapper and add the krz-theme class to it, so the shades are worked out again for that section. Modals, drawers and toasts render outside the wrapper and keep the page's color.

<section className="krz-theme" style={{ "--krz-primary": "#8b5cf6" } as React.CSSProperties}>
  <Button>Violet here</Button>
</section>

Tokens

VariableDescription
--krz-primaryThe brand color. Every shade below is derived from it.
--krz-primary-hoverHover shade for filled brand surfaces.
--krz-primary-2Second stop of the brand gradient.
--krz-primary-softPale brand tint for soft backgrounds.
--krz-primary-textBrand color for text (words and numbers) — a darker, readable shade of --krz-primary.
--krz-primary-strongBrand color for borders, icons and focus rings — visible on light backgrounds.
--krz-primary-contrastText and icons drawn on top of the brand color: white on a dark brand color, dark on a light one.
--krz-bg / --krz-surfacePage and component backgrounds.
--krz-borderDefault border color.
--krz-text / --krz-text-mutedPrimary and secondary text colors.
--krz-radiusDefault corner radius (also -sm, -lg, -full).
--krz-fontFont family for every component.

Dark mode

Dark mode follows the OS by default. To control it yourself, set data-theme="dark" or data-theme="light" (or the class dark / light) on <html> or any wrapper.

<html data-theme="dark">...</html>