Convert Figma logo to code with AI

windicss logowindicss

Next generation utility-first CSS framework.

6,511
181
6,511
224

Top Related Projects

A utility-first CSS framework for rapid UI development.

16,276

The instant on-demand atomic CSS engine.

3,765

The smallest, fastest, most feature complete Tailwind-in-JS solution in existence.

๐Ÿฆนโ€โ™‚๏ธ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at build time.

37,442

โšก๏ธ Simple, Modular & Accessible UI Components for your React Applications

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress ๐Ÿ’…

Quick Overview

Windi CSS is a next-generation utility-first CSS framework. It's designed to be faster, more intuitive, and more flexible than traditional CSS frameworks, offering a just-in-time engine for on-demand CSS generation.

Pros

  • Faster compilation and smaller bundle sizes compared to Tailwind CSS
  • On-demand CSS generation, resulting in improved development experience
  • Supports variant groups and shortcuts for more concise markup
  • Compatible with existing Tailwind CSS configurations

Cons

  • Smaller community and ecosystem compared to Tailwind CSS
  • May require learning new syntax and concepts for those familiar with traditional CSS frameworks
  • Limited browser support for some advanced features
  • Potential for increased complexity in large projects due to utility-first approach

Code Examples

  1. Basic utility classes:
<div class="bg-blue-500 text-white p-4 rounded-lg">
  This is a blue box with white text and rounded corners
</div>
  1. Using variant groups:
<button class="bg-blue-500 hover:(bg-blue-600 scale-105)">
  Hover me
</button>
  1. Creating a custom shortcut:
// windi.config.js
export default {
  shortcuts: {
    'btn': 'py-2 px-4 font-semibold rounded-lg shadow-md',
    'btn-green': 'btn text-white bg-green-500 hover:bg-green-700',
  },
}
  1. Using the custom shortcut:
<button class="btn-green">
  Click me
</button>

Getting Started

  1. Install Windi CSS:
npm install windicss -D
  1. Add Windi CSS to your build tool (e.g., Vite):
// vite.config.js
import WindiCSS from 'vite-plugin-windicss'

export default {
  plugins: [
    WindiCSS(),
  ],
}
  1. Import Windi CSS in your main JavaScript file:
import 'virtual:windi.css'
  1. Start using Windi CSS utility classes in your HTML:
<div class="container mx-auto p-4">
  <h1 class="text-2xl font-bold mb-4">Hello, Windi CSS!</h1>
  <p class="text-gray-600">Start building your awesome project.</p>
</div>

Competitor Comparisons

A utility-first CSS framework for rapid UI development.

Pros of Tailwind CSS

  • Larger community and ecosystem, with more resources and third-party tools
  • More frequent updates and active development
  • Better documentation and official learning resources

Cons of Tailwind CSS

  • Slower build times, especially for larger projects
  • Larger file sizes due to generating all utility classes
  • Steeper learning curve for developers new to utility-first CSS

Code Comparison

Tailwind CSS:

.btn {
  @apply py-2 px-4 bg-blue-500 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75;
}

Windi CSS:

.btn {
  @apply py-2 px-4 bg-blue-500 text-white font-semibold rounded-lg shadow-md;
  &:hover {
    @apply bg-blue-700;
  }
  &:focus {
    @apply outline-none ring-2 ring-blue-400 ring-opacity-75;
  }
}

Windi CSS offers a more concise syntax for nested styles, while Tailwind CSS requires all utility classes to be applied directly to the element. Both frameworks provide similar functionality, but Windi CSS aims to improve performance and developer experience with features like on-demand atomic CSS generation and faster compilation times.

16,276

The instant on-demand atomic CSS engine.

Pros of UnoCSS

  • Faster performance and smaller bundle size due to its atomic CSS approach
  • More flexible and customizable with a plugin system and preset options
  • Supports real-time CSS generation, improving development experience

Cons of UnoCSS

  • Steeper learning curve for developers unfamiliar with atomic CSS concepts
  • Less comprehensive documentation compared to Windi CSS
  • May require additional configuration for complex projects

Code Comparison

UnoCSS:

.text-red-500 {
  color: rgb(239 68 68);
}
.bg-blue-200 {
  background-color: rgb(191 219 254);
}

Windi CSS:

.text-red-500 {
  --tw-text-opacity: 1;
  color: rgba(239, 68, 68, var(--tw-text-opacity));
}
.bg-blue-200 {
  --tw-bg-opacity: 1;
  background-color: rgba(191, 219, 254, var(--tw-bg-opacity));
}

UnoCSS generates more concise CSS output, while Windi CSS includes additional utility variables for opacity control. Both frameworks offer similar utility class naming conventions, making it easier for developers to switch between them if needed.

3,765

The smallest, fastest, most feature complete Tailwind-in-JS solution in existence.

Pros of Twind

  • Runtime-based approach allows for dynamic styling without build step
  • Smaller bundle size due to on-demand generation of styles
  • Seamless integration with JavaScript frameworks and libraries

Cons of Twind

  • Potential performance overhead in large applications
  • Less tooling support compared to Windi CSS
  • May require additional configuration for optimal performance

Code Comparison

Windi CSS:

@apply bg-blue-500 text-white p-4 rounded;

Twind:

import { tw } from 'twind'

const buttonStyle = tw`bg-blue-500 text-white p-4 rounded`

Both Windi CSS and Twind aim to improve upon Tailwind CSS, but they take different approaches. Windi CSS focuses on compilation and build-time optimizations, while Twind emphasizes runtime flexibility and JavaScript integration. Windi CSS may be more suitable for larger projects with complex build processes, while Twind shines in dynamic environments and rapid prototyping scenarios. The choice between the two depends on specific project requirements, development workflow, and performance considerations.

๐Ÿฆนโ€โ™‚๏ธ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at build time.

Pros of twin.macro

  • Offers a unique CSS-in-JS approach with Tailwind-like utility classes
  • Provides better TypeScript support and autocompletion
  • Allows for dynamic styling with JavaScript expressions

Cons of twin.macro

  • Requires additional setup and configuration compared to Windi CSS
  • May have a steeper learning curve for developers new to CSS-in-JS
  • Limited to React-based projects

Code Comparison

twin.macro:

import tw from 'twin.macro'

const Button = tw.button`
  bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded
`

Windi CSS:

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
  Click me
</button>

Summary

twin.macro offers a unique CSS-in-JS approach with Tailwind-like utility classes, providing better TypeScript support and dynamic styling capabilities. However, it requires additional setup and is limited to React projects. Windi CSS, on the other hand, offers a more traditional utility-first CSS framework that works across various frameworks and has a simpler setup process. The choice between the two depends on project requirements, developer preferences, and the desired level of integration with JavaScript.

37,442

โšก๏ธ Simple, Modular & Accessible UI Components for your React Applications

Pros of Chakra UI

  • Comprehensive component library with a wide range of pre-built, accessible UI components
  • Highly customizable with a powerful theming system and style props
  • Strong TypeScript support and excellent documentation

Cons of Chakra UI

  • Larger bundle size compared to Windi CSS
  • Steeper learning curve for developers new to component-based styling
  • More opinionated approach to styling, which may not suit all project needs

Code Comparison

Chakra UI:

import { Box, Text } from "@chakra-ui/react"

<Box bg="tomato" w="100%" p={4} color="white">
  <Text fontSize="xl">This is a Chakra UI box</Text>
</Box>

Windi CSS:

<div class="bg-tomato w-full p-4 text-white">
  <p class="text-xl">This is a Windi CSS box</p>
</div>

Summary

Chakra UI is a feature-rich component library with a focus on accessibility and customization, while Windi CSS is a utility-first CSS framework that offers faster compilation and a smaller bundle size. Chakra UI provides a more structured approach to building UI components, whereas Windi CSS offers greater flexibility and simplicity for rapid prototyping and development.

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress ๐Ÿ’…

Pros of styled-components

  • Component-based styling with JavaScript
  • Dynamic styling based on props
  • Automatic critical CSS extraction

Cons of styled-components

  • Steeper learning curve for developers new to CSS-in-JS
  • Potential performance overhead in large applications
  • Requires additional setup and dependencies

Code Comparison

styled-components:

const Button = styled.button`
  background-color: ${props => props.primary ? 'blue' : 'white'};
  color: ${props => props.primary ? 'white' : 'blue'};
  padding: 10px 20px;
`;

Windi CSS:

<button class="bg-blue-500 text-white p-2 hover:bg-blue-600">
  Click me
</button>

styled-components allows for dynamic styling based on props and keeps styles scoped to components. Windi CSS, on the other hand, uses utility classes for rapid development and offers a more traditional approach to styling. While styled-components provides more flexibility in terms of dynamic styling, Windi CSS excels in performance and ease of use for developers familiar with utility-first CSS frameworks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

รขยšย รฏยธย Windi CSS is Sunsetting รขยšย รฏยธย
We are sunsetting Windi CSS and we recommend new projects to seek for alternatives. Read the full blog post.


Windi CSS Logo
Windi CSS

Npm Version Total Downloads Build Status Coverage
Discord Chat

Next generation utility-first CSS framework.

Why Windi CSS? รฐยŸยคย”

A quote from the author should illustrate his motivation to create Windi CSS:

When my project became larger and there were about dozens of components, the initial compilation time reached 3s, and hot updates took more than 1s with Tailwind CSS. - @voorjaar

By scanning your HTML and CSS and generating utilities on demand, Windi CSS is able to provide faster load times and a speedy HMR in development, and does not require purging in production.

Read more about it in the Introduction.

Integrations

Windi CSS provides first-class integrations for your favorite tools, select yours and get started.

FrameworksPackageVersion
CLIBuilt-in
VSCode Extensionwindicss-intellisense
Vitevite-plugin-windicss
Rolluprollup-plugin-windicss
Webpackwindicss-webpack-plugin
Nuxtnuxt-windicss
Sveltesvelte-windicss-preprocess
StencilJSstencil-windicssCommunity

Plugins รฐยŸย›ย 

Check out plugins available for windicss.

Documentation รฐยŸย“ย–

Check the documentation website.

Discussions

Weรขย€ย™re using GitHub Discussions as a place to connect with other members of our community. You are free to ask questions and share ideas, so enjoy yourself.

Contributing

If you're interested in contributing to windicss, please read our contributing docs before submitting a pull request.

Sponsors

Backers

License

Distributed under the MIT License.

NPM DownloadsLast 30 Days