klass

class variant utility library

npm install @klass/core
  • First-class Variants
  • Conditions Variants
  • Group & Slots
  • Styled-like API
  • Framework-agnostic
  • Fully-typed
Feature-rich
import { klass } from "@klass/core";

const button = klass({
  base: "button",
  variants: {
    color: {
      primary: "button-primary",
      secondary: "button-secondary",
    },
    size: {
      sm: "button-sm",
      md: "button-md",
      lg: "button-lg",
    },
  },
  defaults: {
    color: "primary",
    size: "md",
  },
});
1.47 kB 743 B (GZIP)
Bundle-size
Official Integrations