Skip to content

Familiar utilities.Enforced rules.

A compiler for component styles. Write familiar utilities, enforce your design system, and ship static CSS.

For people who write code.
And agents that write a lot of it.

Write with confidence.

A familiar utility can still contain a typo. Stillwind resolves each utility and reports what needs your attention.

Define lint rules for colors and breakpoints. Stillwind applies those rules in editors, agents, and CI.

Stillwind normalizes equivalent utilities and sorts them into a consistent order. Make code easier to read, review, and change.

Stillwind compiles static utilities to framework props and CSS you can inspect.

style("py-2 text-action-foreground px-4 bg-actoin rounded-control")

unknown-utility

`bg` has no value `actoin`; did you mean `bg-action`?

$ stillwind lint

no-arbitrary-breakpoints

variant `min-[713px]` uses an arbitrary breakpoint `(width >= 713px)`; use a named variant

no-arbitrary-colors

arbitrary color `#d9e2f0` is forbidden for `background-color`; use a theme token or custom property

stillwind.config.ts · lint.rules

{
  "no-arbitrary-breakpoints": "deny",
  "no-arbitrary-colors": "deny",
}

prefer-canonical-utilities

replace `px-[16px]` with `px-4`

$ stillwind lint --fix$ stillwind fmt

Output (React)

{ className: "sw_kzu7a" }

Compiled CSS

.sw_kzu7a {
  border-radius: var(--radius-control);
  background-color: var(--color-action);
  padding-inline: calc(var(--spacing) * 4);
  padding-block: calc(var(--spacing) * 2);
  color: var(--color-action-foreground);
}

Scroll to explore

Check

A familiar utility can still contain a typo. Stillwind resolves each utility and reports what needs your attention.

style
("
py-2
text-action-foreground
px-4
bg-actoin

unknown-utility

`bg` has no value `actoin`; did you mean `bg-action`?

rounded-control
")

$ stillwind lint

Constrain

Define lint rules for colors and breakpoints. Stillwind applies those rules in editors, agents, and CI.

style
("
py-2
text-action-foreground
min-[713px]:px-6

no-arbitrary-breakpoints

variant `min-[713px]` uses an arbitrary breakpoint `(width >= 713px)`; use a named variant

bg-[#d9e2f0]

no-arbitrary-colors

arbitrary color `#d9e2f0` is forbidden for `background-color`; use a theme token or custom property

rounded-control
")
{
  "no-arbitrary-breakpoints": "deny",
  "no-arbitrary-colors": "deny",
}

Normalize & Format

Stillwind normalizes equivalent utilities and sorts them into a consistent order. Make code easier to read, review, and change.

Original

style
("
py-2
text-action-foreground
px-[16px]

prefer-canonical-utilities

replace `px-[16px]` with `px-4`

bg-action
rounded-control
")

Normalized

style("py-2 text-action-foreground px-4 bg-action rounded-control")

$ stillwind lint --fix

Formatted

style("rounded-control bg-action px-4 py-2 text-action-foreground")

$ stillwind fmt

Compile

Stillwind compiles static utilities to framework props and CSS you can inspect.

Input

style
("
rounded-control
bg-action
px-4
py-2
text-action-foreground
")

Output (React)

{ className: "sw_kzu7a" }

Compiled CSS

.sw_kzu7a {
  border-radius: var(--radius-control);
  background-color: var(--color-action);
  padding-inline: calc(var(--spacing) * 4);
  padding-block: calc(var(--spacing) * 2);
  color: var(--color-action-foreground);
}

Express more with familiar CSS.

Write a utility string with the Tailwind CSS classes you know.

Utility strings

01 / 07

Utility strings

Write a utility string with the Tailwind CSS classes you know.

style("rounded-control px-4 py-2")

JavaScript conditions

Combine utilities with JavaScript conditions. A false condition contributes no classes.

style("rounded-control px-4 py-2", emphasized && "shadow-sm")

emphasized = true

Arrays

Compose strings and conditional values in arrays. Keep related inputs together.

style(["rounded-control px-4 py-2", emphasized && "shadow-sm"])

emphasized = true

CSS states

Use an attribute to select CSS rules. Toggling aria-pressed updates the button while its class name stays the same.

style(
  ["rounded-control px-4 py-2", emphasized && "shadow-sm"],
  { "aria-pressed:": "bg-action text-action-foreground" },
)

emphasized = true

aria-pressed="true"

Toggle the button state.

Variant groups

Group strings and arrays under one variant. The aria-pressed state applies the grouped rules together.

style(
  ["rounded-control px-4 py-2", emphasized && "shadow-sm"],
  {
    "aria-pressed:": ["bg-action text-action-foreground", "font-medium"],
  },
)

emphasized = true

aria-pressed="true"

Toggle the button state.

Nested variants

Nest variants to describe conditions that apply together. Hover styles only apply while the button is pressed.

style(
  ["rounded-control px-4 py-2", emphasized && "shadow-sm"],
  {
    "aria-pressed:": [
      "bg-action text-action-foreground font-medium",
      { "hover:": "bg-action-hover" },
    ],
  },
)

emphasized = true

aria-pressed="true"

Toggle the button state. Hover to preview.

CSS custom properties

Pass a value through a CSS custom property and reference it from utilities. CSS can use the value across different rules.

style(
  ["rounded-control px-4 py-2", emphasized && "shadow-sm"],
  {
    "--accent": accent,
    "aria-pressed:": [
      "bg-(--accent) text-action-foreground font-medium",
      { "hover:": "brightness-110" },
    ],
  },
)

emphasized = true

aria-pressed="true"

accent = var(--color-action-hover)

Toggle the button state. Hover to preview.

Name a container with a ref and query its width from an article card. Its thumbnail and text switch from a row to a stack as the container narrows.

Container queries

01 / 03

Container queries

Name a container with a ref and query its width from an article card. Its thumbnail and text switch from a row to a stack as the container narrows.

const box = style.ref();

style(box, box.asContainer("inline-size"));

style("grid gap-4 justify-items-center text-center", {
  [box.at("width >= 13rem")]: [
    "grid-cols-[3rem_1fr]",
    "justify-items-start text-start",
  ],
});
300px

Better form labels

ARTICLE · 5 MIN READ

Scoped refs

Scope a Save button's pressed state to its article card. Each button reveals the Saved label in its own card.

const card = style.ref();
const button = style.ref();

style(card);
style(button);
style("opacity-0", {
  [button("aria-pressed").in(card)]:
    "opacity-100",
});

ARTICLE

Better form labels

ARTICLE

Clearer error messages

Click Save on either article.

CSS Anchor Positioning

Declare a CSS anchor on a Save button. Its attached label shifts sideways and flips above the button to stay inside the container.

const saveButton = style.ref();

style(saveButton, saveButton.asAnchor());
style(
  saveButton.positionAnchor(),
  "absolute [position-area:bottom]",
  "[position-try-fallbacks:flip-block]",
);
Save to reading list

Declare reusable keyframes with utility strings. Apply duration, easing, and fill options where you use the animation.

Keyframes

01 / 02

Keyframes

Declare reusable keyframes with utility strings. Apply duration, easing, and fill options where you use the animation.

const enter = style.keyframes({
  from: "opacity-0 translate-y-8",
  to: "opacity-100 translate-y-0",
});

style(enter("duration-420 ease-out both"));
Saved to your list

View Transitions

Pair an article's thumbnail, title, and metadata across views with timing utilities, then trigger document.startViewTransition().

const article = style.viewTransition({
  group: "duration-300 ease-out",
  old: "duration-150",
  new: "delay-150 duration-150",
});

style(article.for("thumbnail"));
style(article.for("title"));
style(article.for("meta"));

Labels that make forms easier to complete.

Scroll to explore

Start with your framework.

Keep the component model you know. Add Stillwind to your build and import the style API for your framework. Stillwind is currently in early development.

Read the setup guide

Tailwind CSS compatibility

Use Tailwind CSS v4 utilities, theme variables, and CSS directives. See the migration guide for configuration and plugin compatibility.

Room for existing patterns

Utility strings, arrays, and conditions fit existing components. Recipe factories are available when you need them.

CSS for Web Components

Use explicit CSS exports to place compiled styles in a Shadow DOM or another scope you control.

Type to search the documentation.