Component kit

React components in plain CSS

Styles sit at zero specificity, so any class of yours overrides them.

Usage

Every component renders its own class next to yours. Classes are never merged: the cascade decides.

notifications
copy to clipboard
react
css
typescript
Your classes always win.

get started

npm install margo-ui

5.5 kB minified + gzipped

Your styles, in control

Built to stay out of your way. Every kit rule uses :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

A small set of values shapes the whole kit: colour, border width and radius. Change one, and every component follows.

How tokens work

Tokens are --margo-* custom properties read directly by components. Redeclare one after importing the kit to update its value everywhere.

Colours

Colour tokens describe a role, not a hue: main names the surface, while on-main names the content shown on it.

Border and radius

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 and dark

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

Make the kit feel like yours. Shape every component, restyle one across your app, or fine-tune a single use.

The whole kit

Change colour, border width or radius with a custom property after importing the kit. Each value is shared, so one adjustment updates every component.

One component, everywhere

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.

A variant of your own

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 brings the whole kit in. Add it to your entry stylesheet and you’re ready to go.

Stylesheet

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.

With Tailwind

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.

Fonts and type

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.

Server Components

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.