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.

css
/* 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.

tokentailwindvalue
--margo-color-mainmain#f3f3f3light#151515darkpage background
--margo-color-on-mainon-main#151515light#f3f3f3darktext and icons on main
--margo-color-neutralneutral#fffffflight#000000darkthe far end of the theme: white in light, black in dark
--margo-color-on-neutralon-neutral#000000light#ffffffdarktext and icons on neutral
--margo-color-primaryprimary#57e550the accent: active and focused states, glows
--margo-color-primary-darkenprimary-darken#45b93fthe darker accent, and the other end of primary gradients
--margo-color-lowlowon-main 3.5% in mainlighton-main 2.5% in maindarkquiet fills, like the background of Item and Input
--margo-color-low-alphalow-alphaon-main 3.5%, translucentlighton-main 2.5%, translucentdarkthe same fill, for surfaces other than main
--margo-color-mediummedium#808080light#999999darkmuted text and icons at rest
--margo-color-borderborder#cececelight#2c2c2cdarkborders

Typography

tokentailwindvalue
--margo-font-family-primaryfont-primary"Nunito", helvetica, sans-seriftext
--margo-font-family-secondaryfont-secondary"Bebas Neue", impact, sans-seriftitles; a capitals-only display face
tokentailwindvalue
--margo-font-size-mctext-mc0.625remChip, Label
--margo-font-size-xstext-xs0.75remButtonMicro, Code, Table, Tooltip
--margo-font-size-smtext-sm0.875remButton, Item, Input, Select, TextArea, dialog and sheet bodies
--margo-font-size-basetext-base1rem
--margo-font-size-mdtext-md1.125remHeader.Title
--margo-font-size-lgtext-lg1.375rem
--margo-font-size-2lgtext-2lg1.5rem
--margo-font-size-xltext-xl1.75rem
--margo-font-size-2xltext-2xl2rem
--margo-font-size-3xltext-3xl2.5rem
--margo-font-size-4xltext-4xl3rem
--margo-font-size-5xltext-5xl4rem
--margo-font-size-6xltext-6xl5.25rem
--margo-font-size-7xltext-7xl6.75rem
--margo-font-size-8xltext-8xl8.75rem
--margo-font-size-9xltext-9xl11.25rem
tokentailwindvalue
--margo-font-weight-*font-thin … font-black100 … 900thin, 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.

tokentailwindvalue
--margo-line-heightleading-base1.5the base; the scale divides it
--leading-mcleading-mc0.25base / 6
--leading-xsleading-xs0.5base / 3
--leading-smleading-sm0.75base / 2
--leading-mdleading-md1base × 2/3
--leading-lgleading-lg1.25base × 5/6
--leading-xlleading-xl1.75base × 7/6
--leading-2xlleading-2xl2base × 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.

tokentailwindvalue
--margo-borderborder-margo1.5pxthe border width; also border-t-margo, border-x-margo and the other sides
--margo-radiusrounded-margo-base0.5remthe largest radius
--radius-margo-smrounded-margo-sm0.375remradius × 3/4
--radius-margo-xsrounded-margo-xs0.25remradius / 2
--radius-margo-mcrounded-margo-mc0.125remradius / 4

Shadows

tokentailwindvalue
--margo-shadow-cardshadow-card0 8px 6px -4px rgb(220 220 220 / 0.5)light0 4px 12px -4px rgb(0 0 0 / 0.5)darkCard, Popover
--margo-shadow-buttonshadow-button0 2px 3px -1px rgb(220 220 220 / 0.6)light0 2px 6px -2px rgb(0 0 0 / 0.5)darkactive Button
--margo-shadow-itemshadow-item0 3px 3px -3px rgb(139 139 139 / 0.6)light0 2px 3px -2px rgb(0 0 0 / 0.5)darkItem, Input, Select, TextArea on hover
--margo-shadow-chipshadow-chip0 1px 3px -1px rgb(0 0 0 / 0.6)light0 1px 3px -1px rgb(0 0 0 / 0.5)darkChip

Motion

tokentailwindvalue
--margo-layer-durationduration-(--margo-layer-duration)750msLayer and Sheet opening and closing
--margo-layer-easingease-layercubic-bezier(0.32, 0.72, 0, 1)the same transitions
--margo-popover-duration—200msPopover opening and closing
--margo-popover-easing—cubic-bezier(0.32, 0.72, 0, 1)the same transition

Z-index

tokentailwindvalue
--margo-layer-z-indexz-layer100Layer
--margo-max-z-indexz-max9999anything 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.

tokentailwindvalue
--breakpoint-480480:480pxlarge phones
--breakpoint-640640:640pxsmall tablets
--breakpoint-768768:768pxtablets
--breakpoint-900900:900pxsmall laptops
--breakpoint-10801080:1080pxdesktops
--breakpoint-12801280:1280pxwide desktops
--breakpoint-14401440:1440pxlarge displays
--breakpoint-19201920:1920pxvery wide displays

Grid

tokentailwindvalue
--margo-grid-max-width—80remthe widest the content area gets, padding excluded
--margo-grid-paddingmargo-padding-*1remside padding of the grid
--margo-grid-gutter-xmargo-gutter-x-*clamp(0.5rem, 2.2vw, 2rem)space between columns
--margo-grid-gutter-ymargo-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:

css
/* 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.

css
/* your own theme file, imported after the kit */
@theme {
  --spacing-navbar: 3.5rem;
  --z-index-navbar: 50;
  --breakpoint-1600: 1600px;
}