⚑Zero dependencies · No build step

Utility-First CSS,
Straight in the Browser

Write leaf-* class names β€” styles get injected automatically.
No compilation. No config files. Just one script tag.

View on npm β†’ GitHub β†—
index.html
<!-- CDN -->
<script src="https://cdn.jsdelivr.net/npm/@chandan632/leaf-css/dist/leaf.min.js"></script>

<!-- Use anywhere -->
<div class="leaf-flex leaf-p-4 leaf-bg-blue leaf-rounded-lg leaf-text-white">
  Hello leaf-css!
</div>
🎨 Colors ✍️ Typography πŸ“ Flex & Grid πŸ“± Responsive πŸŒ™ Dark Mode ✨ Animations 🎯 Pseudo-classes πŸ”’ Arbitrary Values 🌈 Gradients βš™οΈ configure()
Colors

Color Palette

Use leaf-bg-* Β· leaf-text-* Β· leaf-border-*

Base colors

red
orange
yellow
lime
green
emerald
teal
cyan
sky
blue
indigo
violet
purple
fuchsia
pink
rose
amber
black
white

Light & dark variants

light-blue
blue
dark-blue
light-teal
teal
dark-teal
light-green
green
dark-green
light-purple
purple
dark-purple
light-rose
rose
dark-rose
light-indigo
indigo
dark-indigo

Numeric scales (100–900)

blue

100
200
300
400
500
600
700
800
900

green

100
200
300
400
500
600
700
800
900

red

100
200
300
400
500
600
700
800
900

purple

100
200
300
400
500
600
700
800
900

orange

100
200
300
400
500
600
700
800
900

teal

100
200
300
400
500
600
700
800
900

rose

100
200
300
400
500
600
700
800
900

indigo

100
200
300
400
500
600
700
800
900

gray

100
200
300
400
500
600
700
800
900

slate

100
200
300
400
500
600
700
800
900

zinc

100
200
300
400
500
600
700
800
900
Typography

Font Sizes & Styles

text-xs The quick brown fox jumps over the lazy dog
text-sm The quick brown fox jumps over the lazy dog
text-base The quick brown fox jumps over the lazy dog
text-lg The quick brown fox
text-xl The quick brown fox
text-2xl The quick brown fox
text-3xl The quick brown fox
text-5xl Heading

Text styles

Bold Light weight Italic text Underlined Line-through Uppercase Wide Semibold
Spacing & Borders

Padding Β· Margin Β· Radius Β· Border

Border radius scale

none
sm
md
lg
xl
2xl
full

Border styles

border
border-2
border-4
dashed
dotted
border-color

Shadows

shadow-sm
shadow
shadow-md
shadow-lg
shadow-xl
Interactivity

Pseudo-classes

hover Β· focus Β· active Β· disabled

Layout

Flexbox & Grid

flex Β· justify-between Β· items-center

leaf-flex leaf-justify-between

grid-cols-3 + gap-4

1
2
3

col-span-2 Β· col-span-full

col-span-2
1
col-span-full

Responsive: grid-cols-1 β†’ md:2 β†’ lg:4

A
B
C
D
Responsive

Breakpoints

sm:640 Β· md:768 Β· lg:1024 Β· xl:1280 Β· 2xl:1536

Resize the window β€” this text changes size

Mobile: red Β· Tablet: yellow Β· Desktop: green
Block 1
Block 2
Block 3
πŸ“± Mobile πŸ“Ÿ Tablet πŸ–₯ Desktop
Arbitrary values

Custom Values

Pass any value directly with leaf-*-[value] syntax.

leaf-p-[30px] β†’ padding: 30px
leaf-bg-[#ff6b6b] β†’ custom hex color

leaf-text-[#9333ea] β†’ custom text color

leaf-w-[320px] β†’ fixed width
leaf-w-[calc(100%-40px)] β†’ calc()
Animations & Transforms

Motion

Spinners

Pulse Β· Bounce

πŸƒ

Scale on hover Β· Rotate on hover

↻
πŸ–Ό Zoom

Entrance animations

fade-in
slide-up
slide-left
slide-right
zoom-in
wiggle
Gradients

Linear Β· Three-color Β· Text

Linear gradients

primary β†’ secondary
blue β†’ purple
orange β†’ pink
diagonal
brand β†’ secondary
light-red β†’ dark-red

Three color (via)

red β†’ yellow β†’ green
blue β†’ purple β†’ pink
success β†’ primary
dark β†’ mid β†’ light blue

Gradient text

Gradient Text

Three Colors

πŸƒ leaf-css

configure()

Theming

Extend the default palette with your own tokens. Fully optional β€” defaults work out of the box.

window.__leafConfig = {
  colors: {
    primary:   '#6366f1',
    secondary: '#8b5cf6',
    brand:     '#ff6b6b',
  },
  extend: {
    spacing:  { 13: '52px' },
    fontSizes: { hero: '72px' },
  },
};

Custom colors

primary
primary-dark
primary-light
secondary
brand
success
warning
danger

Custom font-size: text-hero

Aa

Custom spacing: p-13 β†’ 52px

This uses leaf-p-13 β€” a custom spacing token via extend.spacing
MutationObserver

Dynamic DOM

Elements added after page load are automatically processed. Works with React, Vue, and any dynamic content.