Socket
Socket
Sign inDemoInstall

unocss

Package Overview
Dependencies
377
Maintainers
2
Versions
354
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    unocss

The instant on-demand Atomic CSS engine.


Version published
Weekly downloads
255K
decreased by-24.01%
Maintainers
2
Created
Weekly downloads
ย 

Package description

What is unocss?

UnoCSS is an atomic-CSS engine that provides a highly customizable and performant way to style your web applications. It allows you to write utility-first CSS directly in your HTML or JavaScript, and it generates the necessary CSS on-demand.

What are unocss's main functionalities?

Utility-First CSS

UnoCSS allows you to use utility classes directly in your HTML to style elements. In this example, the text is centered and colored red using utility classes.

<div class="text-center text-red-500">Hello, UnoCSS!</div>

On-Demand Generation

UnoCSS generates the necessary CSS only for the classes you use, making it highly efficient. This example demonstrates how to create a styled button using utility classes.

import 'uno.css';

const button = document.createElement('button');
button.className = 'bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded';
document.body.appendChild(button);

Customizable

UnoCSS is highly customizable. You can define your own theme and utility classes. This example shows how to configure a custom theme with specific colors.

import { defineConfig } from 'unocss';

export default defineConfig({
  theme: {
    colors: {
      primary: '#3490dc',
      secondary: '#ffed4a',
      danger: '#e3342f',
    },
  },
});

Other packages similar to unocss

Readme

Source

UnoCSS

The instant on-demand Atomic CSS engine.

NPM version

๐Ÿ’ก I highly recommend reading this blog post -
Reimagine Atomic CSS
for the story behind


๐Ÿ“š Documentation | ๐Ÿง‘โ€๐Ÿ’ป Interactive Docs | ๐Ÿคนโ€โ™‚๏ธ Playground


Features

Inspired by Windi CSS, Tailwind CSS, and Twind, but:

  • Fully customizable - no core utilities. All functionalities are provided via presets.
  • No parsing, no AST, no scanning, it's INSTANT (5x faster than Windi CSS or Tailwind JIT).
  • ~6kb min+brotli - zero deps and browser friendly.
  • Shortcuts - aliasing utilities, dynamically.
  • Attributify mode - group utilities in attributes.
  • Pure CSS Icons - use any icon as a single class.
  • Variant Groups - shorthand for group utils with common prefixes.
  • CSS Directives - reuse utils in CSS with @apply directive.
  • Compilation mode - synthesizes multiple classes into one at build time.
  • Inspector - inspect and debug interactively.
  • CSS-in-JS Runtime build - use UnoCSS with one line of CDN import.
  • VS Code extension
  • Code-splitting for CSS - ships minimal CSS for MPA.

Documentation

Read the documentation for more details.

Installation

Acknowledgement

UnoCSS is made possible thanks to the inspirations from the following projects:

in alphabetical order

Sponsors

License

MIT License ยฉ 2021-PRESENT Anthony Fu

Keywords

FAQs

Last updated on 12 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc