talira

The instant on-demand atomic CSS engine

open sourceMITself-hostablefree

UnoCSS is an atomic CSS engine: it finds the utility classes your code uses and generates only those rules, from rules, variants and shortcuts you define in uno.config.ts or take from presets. The core has no utilities of its own; official presets add Tailwind CSS–compatible utilities (preset-wind3 and preset-wind4, close to Tailwind CSS), pure CSS icons from any Iconify set, web fonts, typography, and attributify and tagify modes that let you write utilities as HTML attributes or tags. It runs as a Vite plugin, a Nuxt module, Astro, Svelte, webpack, Rollup and PostCSS integrations, a CLI or a CDN runtime that generates CSS in the browser, with an inspector, an ESLint config and a VS Code extension. It was started by a Windi CSS team member, Anthony Fu, and its docs call it Windi CSS's spiritual successor.

Problems it solves

  • I want Tailwind-style utility classes but with my own design system's naming conventions
  • generate only the CSS classes my components actually use, instantly, with fast hot reload in Vite
  • use icons from any Iconify icon set as pure CSS classes without importing SVG components
  • define a dynamic rule like m-7.5 once with a regex and have every value work
  • share our company's utility rules as a preset across all our frontend projects
  • write utilities as HTML attributes instead of one long class string
  • add utility CSS to a page from a CDN script with no build step, generated in the browser
  • Windi CSS is no longer maintained; what should replace it in our Vite projects
  • group variants like hover:(bg-gray-400 font-medium) instead of repeating the prefix on every class
  • see which utility rules were generated for each file and why, in a browser inspector

Features

  • on-demand generation: only the utilities your code uses are emitted
  • fully customisable rules (static or regex), variants and shortcuts in uno.config.ts
  • official presets: mini, wind3 and wind4 (Tailwind CSS compatible), attributify, tagify, icons, web fonts, typography, rem-to-px
  • pure CSS icons from Iconify icon sets
  • attributify mode, valueless attributify and tagify
  • transformers for variant groups, directives and compile-class mode
  • integrations for Vite, Nuxt, Next.js, Astro, Svelte Scoped, webpack, Rollup and Rolldown, and PostCSS
  • CLI and a CDN runtime that generates CSS in the browser
  • inspector to see generated rules per module
  • ESLint config, a language server and an official VS Code extension
View 1 more
  • llms.txt and Markdown copies of every docs page

Limitations

  • Doesn't support Tailwind CSS plugins or configuration files: migrating a heavily customised Tailwind CSS project can be harder1

Capabilities

Has a command line toolplan not known
Takes pluginsplan not known

Alternatives

The same job

These do what UnoCSS does.

  1. Tailwind CSS Rapidly build modern websites without ever leaving your HTML.
  2. daisyUI The most popular, free and open-source component library for Tailwind CSS

Compare UnoCSS with the top 3