Tokens
Every design value in margo-ui is a CSS custom property. This page lists all of them, grouped by what they control.
How tokens work
Each token is declared twice. variables.css holds the value as a --margo-* property, and theme.css maps it to a Tailwind name, so you get regular utilities like bg-primary or rounded-margo-sm.
/* variables.css: the value */
:root {
--margo-color-primary: #57e550;
}
/* theme.css: the Tailwind name */
@theme {
--color-primary: var(--margo-color-primary);
}Colours
Colours are named by role, not by hue: main is the page, on-main is what sits on it. Each one works with every colour utility: bg-main, text-on-main, border-border.
| token | tailwind | value | |
|---|---|---|---|
--margo-color-main | main | #f3f3f3light#151515dark | page background |
--margo-color-on-main | on-main | #151515light#f3f3f3dark | text and icons on main |
--margo-color-neutral | neutral | #fffffflight#000000dark | the far end of the theme: white in light, black in dark |
--margo-color-on-neutral | on-neutral | #000000light#ffffffdark | text and icons on neutral |
--margo-color-primary | primary | #57e550 | the accent: active and focused states, glows |
--margo-color-primary-darken | primary-darken | #45b93f | the darker accent, and the other end of primary gradients |
--margo-color-low | low | on-main 3.5% in mainlighton-main 2.5% in maindark | quiet fills, like the background of Item and Input |
--margo-color-low-alpha | low-alpha | on-main 3.5%, translucentlighton-main 2.5%, translucentdark | the same fill, for surfaces other than main |
--margo-color-medium | medium | #808080light#999999dark | muted text and icons at rest |
--margo-color-border | border | #cececelight#2c2c2cdark | borders |
Typography
| token | tailwind | value | |
|---|---|---|---|
--margo-font-family-primary | font-primary | "Nunito", helvetica, sans-serif | text |
--margo-font-family-secondary | font-secondary | "Bebas Neue", impact, sans-serif | titles; a capitals-only display face |
| token | tailwind | value | |
|---|---|---|---|
--margo-font-size-mc | text-mc | 0.625rem | Chip, Label |
--margo-font-size-xs | text-xs | 0.75rem | ButtonMicro, Code, Table, Tooltip |
--margo-font-size-sm | text-sm | 0.875rem | Button, Item, Input, Select, TextArea, dialog and sheet bodies |
--margo-font-size-base | text-base | 1rem | |
--margo-font-size-md | text-md | 1.125rem | Header.Title |
--margo-font-size-lg | text-lg | 1.375rem | |
--margo-font-size-2lg | text-2lg | 1.5rem | |
--margo-font-size-xl | text-xl | 1.75rem | |
--margo-font-size-2xl | text-2xl | 2rem | |
--margo-font-size-3xl | text-3xl | 2.5rem | |
--margo-font-size-4xl | text-4xl | 3rem | |
--margo-font-size-5xl | text-5xl | 4rem | |
--margo-font-size-6xl | text-6xl | 5.25rem | |
--margo-font-size-7xl | text-7xl | 6.75rem | |
--margo-font-size-8xl | text-8xl | 8.75rem | |
--margo-font-size-9xl | text-9xl | 11.25rem |
| token | tailwind | value | |
|---|---|---|---|
--margo-font-weight-* | font-thin … font-black | 100 … 900 | thin, extralight, light, normal, medium, semibold, bold, extrabold, black |
text-* utilities set only the font size. Line height comes from leading-*, a scale built on --margo-line-height: change the base and every step follows.
| token | tailwind | value | |
|---|---|---|---|
--margo-line-height | leading-base | 1.5 | the base; the scale divides it |
--leading-mc | leading-mc | 0.25 | base / 6 |
--leading-xs | leading-xs | 0.5 | base / 3 |
--leading-sm | leading-sm | 0.75 | base / 2 |
--leading-md | leading-md | 1 | base × 2/3 |
--leading-lg | leading-lg | 1.25 | base × 5/6 |
--leading-xl | leading-xl | 1.75 | base × 7/6 |
--leading-2xl | leading-2xl | 2 | base × 4/3 |
Border and radius
There is one border width. Radii are a scale that divides --margo-radius, so changing it moves every corner and keeps the proportions. Tailwind's own border-* and rounded-* utilities still work.
| token | tailwind | value | |
|---|---|---|---|
--margo-border | border-margo | 1.5px | the border width; also border-t-margo, border-x-margo and the other sides |
--margo-radius | rounded-margo-base | 0.5rem | the largest radius |
--radius-margo-sm | rounded-margo-sm | 0.375rem | radius × 3/4 |
--radius-margo-xs | rounded-margo-xs | 0.25rem | radius / 2 |
--radius-margo-mc | rounded-margo-mc | 0.125rem | radius / 4 |
Shadows
| token | tailwind | value | |
|---|---|---|---|
--margo-shadow-card | shadow-card | 0 8px 6px -4px rgb(220 220 220 / 0.5)light0 4px 12px -4px rgb(0 0 0 / 0.5)dark | Card, Popover |
--margo-shadow-button | shadow-button | 0 2px 3px -1px rgb(220 220 220 / 0.6)light0 2px 6px -2px rgb(0 0 0 / 0.5)dark | active Button |
--margo-shadow-item | shadow-item | 0 3px 3px -3px rgb(139 139 139 / 0.6)light0 2px 3px -2px rgb(0 0 0 / 0.5)dark | Item, Input, Select, TextArea on hover |
--margo-shadow-chip | shadow-chip | 0 1px 3px -1px rgb(0 0 0 / 0.6)light0 1px 3px -1px rgb(0 0 0 / 0.5)dark | Chip |
Motion
| token | tailwind | value | |
|---|---|---|---|
--margo-layer-duration | duration-(--margo-layer-duration) | 750ms | Layer and Sheet opening and closing |
--margo-layer-easing | ease-layer | cubic-bezier(0.32, 0.72, 0, 1) | the same transitions |
--margo-popover-duration | — | 200ms | Popover opening and closing |
--margo-popover-easing | — | cubic-bezier(0.32, 0.72, 0, 1) | the same transition |
Z-index
| token | tailwind | value | |
|---|---|---|---|
--margo-layer-z-index | z-layer | 100 | Layer |
--margo-max-z-index | z-max | 9999 | anything that must sit on top of all |
Breakpoints
Breakpoints are named after their width, so 768: applies from 768px up and max-768: below it. Tailwind's default sm: to 2xl: still work; pick one set and stick to it.
| token | tailwind | value | |
|---|---|---|---|
--breakpoint-480 | 480: | 480px | large phones |
--breakpoint-640 | 640: | 640px | small tablets |
--breakpoint-768 | 768: | 768px | tablets |
--breakpoint-900 | 900: | 900px | small laptops |
--breakpoint-1080 | 1080: | 1080px | desktops |
--breakpoint-1280 | 1280: | 1280px | wide desktops |
--breakpoint-1440 | 1440: | 1440px | large displays |
--breakpoint-1920 | 1920: | 1920px | very wide displays |
Grid
| token | tailwind | value | |
|---|---|---|---|
--margo-grid-max-width | — | 80rem | the widest the content area gets, padding excluded |
--margo-grid-padding | margo-padding-* | 1rem | side padding of the grid |
--margo-grid-gutter-x | margo-gutter-x-* | clamp(0.5rem, 2.2vw, 2rem) | space between columns |
--margo-grid-gutter-y | margo-gutter-y-* | clamp(0.5rem, 2.2vw, 2rem) | space between rows |
Light and dark
The light values are declared on :root, the dark ones on .dark. The theme is whether that class is on the html element, and the dark: variant follows the same class. The kit doesn't read prefers-color-scheme: deciding the theme is up to your app.
When you change a colour or a shadow, change it in both blocks:
/* after @import "margo-ui/css" */
:root {
--margo-color-primary: #4f8cff;
--margo-color-primary-darken: #2f6ad9;
}
.dark {
--margo-color-primary: #7aa9ff;
--margo-color-primary-darken: #4f8cff;
}Adding your own
Declare a @theme block after the kit. Your tokens get utilities the same way the kit's do, and a new breakpoint works on the grid utilities too.
/* your own theme file, imported after the kit */
@theme {
--spacing-navbar: 3.5rem;
--z-index-navbar: 50;
--breakpoint-1600: 1600px;
}