How tokens work
Tokens are --margo-* custom properties read directly by components. Redeclare one after importing the kit to update its value everywhere.
get started
npm install margo-ui5.5 kB minified + gzipped
Your styles, in control
:where() for zero specificity and lives in the components cascade layer.Add a class and make it yours: base styles, breakpoints, hover states or dark mode. No class merging, no surprises.
Your class sits alongside the component's. Nothing gets merged; the cascade gives each style its say.
A class without a variant applies in every state. So bg-primary keeps an active Chip primary on hover and focus. To style just one state, add a variant such as hover:bg-primary.
Tokens
Tokens are --margo-* custom properties read directly by components. Redeclare one after importing the kit to update its value everywhere.
Colour tokens describe a role, not a hue: main names the surface, while on-main names the content shown on it.
The kit uses one border width and one radius, then derives three smaller corner steps. Set --margo-radius on :root to scale them together; the smaller steps are calculated for you.
Light values live on :root; dark values on .dark. Add the class to an element or ancestor, usually html, to apply them. Update both blocks when changing colours; your app controls the theme.
That’s the shared foundation. Shadows, sizes and timings belong to each component; tailor them with your own classes.
Customization
Change colour, border width or radius with a custom property after importing the kit. Each value is shared, so one adjustment updates every component.
Style .margo-button or .margo-button-label to restyle a component or part across your app.
Target states with data-margo-active, data-margo-disabled or data-margo-open.
Use className to tailor a single instance. When that change becomes a pattern, put it in a wrapper and reuse it wherever you need.
Installation
One import adds base styles, shared tokens and every component style; components don't load CSS themselves.
The kit uses base and components layers, so your styles can take precedence.
Tailwind is optional, and the kit works alongside it. Import the kit after tailwindcss so Tailwind's reset loads first; its utilities still take precedence over kit styles.
The kit sets no font or type scale. Components inherit the page font; their required sizes live in component CSS and can be overridden with your classes.
Use every component from a Server Component, including parts such as Button.Label. Browser-side behavior is handled inside the kit, so you don't need an extra wrapper.