Customize components
Every component is built from a few CSS variables of its own. Change one on a single element, on a section, or everywhere, and the component redraws itself. No overriding of selectors, no !important.
Three places to set a variable
<div class="cluster" id="cc-demo">
<button class="btn btn-brand" type="button">Normal</button>
<button class="btn btn-brand" type="button" style="--btn-radius: 999px; --btn-height: 3rem; --btn-pad: 1.5rem">On this one</button>
<span class="cluster cc-group">
<button class="btn" type="button">In this</button><button class="btn" type="button">group</button>
</span>
</div>
<style>.cc-group .btn { --btn-bg: var(--momo-yellow); --btn-color: var(--momo-on-fill); --btn-radius: 0px; }</style><!-- 1. on one element -->
<button class="btn btn-brand" style="--btn-radius: 999px">Save</button>
/* 2. inside one part of the page */
.checkout .btn { --btn-height: 3rem; }
/* 3. everywhere */
.btn { --btn-radius: 999px; }
.card { --card-pad: 1.5rem; }One thing to know: set the variable on the component itself, or with a selector that reaches it (.checkout .btn). A variable set only on a parent is not picked up, because every component starts from its own defaults.
Your CSS is outside Momo's layers, so these rules win without any tricks. For the settings that shape everything at once (the brand color, the line width, the corner size, the font), use Customize.
Make your own variant
A variant is a class that sets variables. It works with every size and state the component already has.
<div class="cluster">
<button class="btn cc-btn-mint" type="button">Mint button</button>
<button class="btn btn-sm cc-btn-mint" type="button">Small</button>
<button class="btn cc-btn-mint" type="button" disabled>Disabled</button>
<span class="badge cc-badge-night">Night badge</span>
</div>
<style>
.cc-btn-mint { --btn-bg: var(--momo-green); --btn-color: var(--momo-on-fill); --btn-radius: 999px; }
.cc-badge-night { --badge-bg: var(--momo-ink); --badge-color: var(--momo-paper); }
</style>.btn-mint { --btn-bg: var(--momo-green); --btn-color: var(--momo-on-fill); --btn-radius: 999px; }
.badge-night { --badge-bg: var(--momo-ink); --badge-color: var(--momo-paper); }The variables, by component
| Component | Its variables |
|---|---|
| Button | --btn-bg, --btn-color, --btn-border, --btn-height, --btn-pad, --btn-font-size, --btn-radius |
| Card | --card-bg, --card-color, --card-border, --card-pad, --card-gap, --card-radius, --card-muted |
| Badge, Chips | --badge-bg, --badge-color, --badge-border, --chip-height |
| Fields | --field-bg, --field-border, --field-shadow, --field-height |
| Checkbox & switch | --check-color, --check-mark, --check-size, --switch-w, --switch-h |
| Slider, Rating | --slider-color, --slider-track, --slider-height, --rating-color, --rating-size |
| Alert & banner | --alert-bg, --alert-color, --alert-muted, --banner-bg, --banner-color |
| Avatar | --avatar-size |
| Tabs | --tab-active-bg, --tab-active-color, --tab-height |
| Table | --table-pad-y, --table-pad-x, --table-line, --table-head-bg, --table-head-color, --table-width |
| Dialog & toast | --dialog-width, --toast-edge |
| Progress | --progress-color, --progress-track, --progress-height, --ring-size, --ring-width |
| Steps, Tree view | --step-size, --tree-indent, --tree-row |
| Navbar | --navbar-height, --navbar-bg, --navbar-color, --navbar-muted, --navbar-line |
| App shell | --sidebar-width, --sidebar-bg, --sidebar-color, --topbar-height |
| Hero, Footer | --hero-bg, --hero-color, --hero-pad, --hero-max, --footer-bg, --footer-color, --footer-pad |
| Container & section | --container-max, --container-pad, --section-pad, --section-bg |
| Carousel, Gallery | --carousel-gap, --slide-size, --gallery-gap |
| Split view, Inbox | --split-list, --inbox-list |
| Description list, Media object | --dl-label, --dl-gap, --media-gap, --media-size |
| Code | --code-bg, --code-color, --code-muted, --code-line |
| Charts | --chart-1, to --chart-8,, --chart-grid, --chart-axis |
Each component's own page has the full list with what each one does.
Good habits
- Set variables, not properties.
.btn { --btn-radius: 0px }keeps hover, focus, sizes and dark mode working;.btn { border-radius: 0 }fights them. - Point colors at Momo's tokens (
var(--momo-green),var(--momo-ink)), not at fixed codes, and dark mode follows by itself. - For fills, use the matching text color
var(--momo-on-fill)so the contrast stays right. - Before making a variant, check the color classes:
.btn-green,.badge-violet-softand.bg-yellowmay already be what you want.