Customize

CSS Variables

Every value in BIMA resolves to a --bima-* CSS custom property. Override them in your own stylesheet to re-theme the whole system.

Overview

BIMA is built entirely on CSS custom properties (CSS variables). There are no hard-coded colours, fonts, sizes, radii, or shadows scattered through the components — every component reads its values from a small set of --bima-* tokens declared on :root in tokens/variables.css. That means you can change a single variable and have the change ripple through every button, card, input, and badge that references it.

The source of truth

All tokens live in tokens/variables.css (shipped as @milvikbima/ui/tokens). The Design Tokens page is the full reference of every name and value.

How to override

Import BIMA first, then re-declare any --bima-* property in your own :root block after the import. Because your declaration comes later in the cascade (and lives on the same :root selector), it wins.

/* 1. Import BIMA (defines all --bima-* tokens on :root) */
@import "@milvikbima/ui/css";

/* 2. Override any token in your own :root, AFTER the import */
:root {
  --bima-navy:        #6d28d9;   /* new brand colour          */
  --bima-font-body:   "Inter", system-ui, sans-serif;
  --bima-radius-md:   4px;       /* tighter input/button radius */
}

You only need to declare the tokens you want to change. Everything you leave out keeps BIMA's default value.

Order matters

Your :root override must be loaded after bima.css. Two rules with the same specificity are resolved by source order — the later one wins. If your overrides appear to do nothing, check the load order.

A worked example

Here is a complete re-theme that changes the brand colour, the body font, and the corner radius. Because components reference the tokens (and never the raw values), this is all it takes.

:root {
  /* Brand — primary buttons, headers, links resolve to this */
  --bima-navy:       #6d28d9;
  --bima-navy-hover: #5b21b6;
  --bima-navy-deep:  #4c1d95;

  /* Typography */
  --bima-font-display: "Sora", system-ui, sans-serif;
  --bima-font-body:    "Inter", system-ui, sans-serif;

  /* Geometry — buttons & inputs use --bima-radius-md */
  --bima-radius-md:  6px;
  --bima-radius-xl:  16px;
}

How components reference tokens

Components never use literal values — they use semantic aliases that resolve back to brand tokens. For example, the primary button reads --bima-interactive-primary, which itself resolves to --bima-navy:

/* In variables.css */
--bima-interactive-primary: var(--bima-navy);

/* In the button component */
.bima-btn--primary {
  background: var(--bima-interactive-primary);
  color:      var(--bima-text-inverse);
}

So overriding --bima-navy automatically updates --bima-interactive-primary and, through it, every primary button — no component CSS needs to change. This indirection is why a one-line override re-themes the whole system.

Live re-theme

The buttons below are ordinary .bima-btn elements. The only difference is a wrapper carrying an inline style="--bima-navy:#6d28d9". The override scopes to that subtree, so the primary button picks up the new brand colour while the default buttons elsewhere on the page stay navy.

Default tokens

Override --bima-navy

<!-- Default buttons -->
<button class="bima-btn bima-btn--primary">Primary</button>

<!-- Same component, re-themed by a scoped override -->
<div style="--bima-navy:#6d28d9; --bima-navy-hover:#5b21b6;">
  <button class="bima-btn bima-btn--primary">Primary</button>
</div>

Cascade & scoping

CSS variables inherit and cascade like any other property, so you can override at three useful levels:

Scope Selector Effect
Global :root Re-themes the entire document.
Subtree .my-section / inline style Re-themes only descendants of that element. Everything outside keeps the default.
Element inline style="--bima-navy:…" One-off override for a single element and its children.

Subtree scoping is the basis of Dark Mode: the .dark class simply re-declares a subset of surface, text, and border tokens on whatever element it is applied to.

/* Re-theme just one region of the page */
.promo-banner {
  --bima-navy:        #b91c1c;
  --bima-radius-pill: 0.5rem;
}
/* Buttons, badges, and links inside .promo-banner pick this up;
   nothing else on the page is affected. */

Next steps

See Design Tokens for the complete list of every --bima-* property and its default value.