Get started
CSS Utils is a lightweight frontend style toolkit based on CSS variables. It provides utility classes, responsive helpers and reusable component styles.
Install
Upgrading from 0.x? Version 1.0.0 removes the legacy typography classes and size-based line-height tokens. Follow the line-height migration and letter-spacing migration before updating your application.
CSS Utils ships as SCSS. Install the package and, if your toolchain does not already provide it, Dart Sass:
npm i @oardi/css-utils
npm i -D sassAdd the styles
Load CSS Utils once through your application’s global stylesheet:
// styles.scss
@use '@oardi/css-utils';The package already defines the cascade order reset, base, components, then utilities, so no separate layer setup is required.
Load individual components
For selected components, load the shared design tokens once alongside the component styles:
@use '@oardi/css-utils/tokens';
@use '@oardi/css-utils/components/button';tokens provides the default CSS variables, dark-theme overrides (data-theme="dark" on <html>) and reduced-motion settings. It also includes the minimal native [hidden] protection shared by every CSS-emitting entry point. Hidden controls and their descendants remain unrendered and unfocusable; hidden="until-found" is left to the browser. This does not load the full reset, typography rules, utilities or component styles, or add global margin, padding or box-sizing resets. Component imports require these tokens unless your application already loads the full library or supplies all required variables. The full import already includes the tokens.
For the Dart Sass CLI, prefix both paths with pkg: and compile with --pkg-importer=node.
Build your first interface
Utilities and component classes can be combined without additional CSS:
<div class="card">
<div class="card-body d-flex flex-column gap-2">
<p class="h5 card-title">Welcome</p>
<p class="mb-0 text-muted">Your CSS Utils setup is ready.</p>
<button class="btn btn-primary btn-solid" type="button">Continue</button>
</div>
</div>This renders as:
Welcome
Your CSS Utils setup is ready.
Customize the design
Override global design tokens in your own stylesheet to match your application:
:root {
--primary: #0057ff;
--primary-hover: #0047d6;
--primary-active: #003cad;
--on-primary: #ffffff;
--action-color: #0047d6;
--action-color-hover: #003cad;
--action-color-active: #002f87;
--focus-outline-color: var(--action-color);
--border-radius: 0.5rem;
}--primary* defines filled surfaces, while --action-color* defines interactive
foregrounds such as links and primary text or outline buttons. Keeping them separate allows a
soft brand surface to use darker, contrast-compliant actions without component selector overrides.
Learn more about utilities, components and design tokens.
Try online
Explore CSS Utils without installing anything in the StackBlitz sandbox:
Open on StackBlitz
Browser support
CSS Utils supports Chrome/Edge 122+, Firefox 128+ and Safari 18+, including iOS and iPadOS. Older browsers and Internet Explorer are not supported.