- Docs
- buttons
Buttons
Global button styles, variants, sizes, and interaction states powered by Flexiwind utilities.
Prerequisites
Create a dedicated file such as button-styles.css
for button variants.
Keep button styles centralized so all intents stay consistent across the app.
Load this file after base token definitions and before app-specific overrides. This order ensures variant classes pick up your final theme values.
Variants
Each variant defines the visual treatment of the button. Intents (such as primary, secondary, success, or destructive) control semantic meaning. Combine both to build a predictable button system.
Solid variants
@utility btn-solid-primary {
--btn-color: var(--color-primary);
--btn-fg: var(--color-primary-foreground);
}
@utility btn-solid-secondary {
--btn-color: var(--color-secondary);
--btn-fg: var(--color-secondary-foreground);
}
@utility btn-solid-accent {
--btn-color: var(--color-accent);
--btn-fg: var(--color-accent-foreground);
}
@utility btn-solid-destructive {
--btn-color: var(--color-destructive);
--btn-fg: var(--color-destructive-foreground);
}
@utility btn-solid-neutral {
--btn-color: var(--color-foreground);
--btn-fg: var(--color-white);
&:is(.dark *) {
--btn-color: var(--color-muted);
--btn-fg: var(--color-foreground);
}
}
@utility btn-solid-success {
--btn-color: var(--color-success);
--btn-fg: var(--color-white);
}
Outline variants
@utility btn-outline-gray {
--btn-color: var(--color-background);
--btn-fg: var(--color-foreground);
--btn-border-color: var(--color-border);
&:is(.dark *) {
--btn-color: transparent;
--btn-fg: var(--color-muted-foreground);
--btn-border-color: var(--color-foreground);
}
}
Soft variants
@utility btn-soft-primary {
--btn-color: var(--color-primary);
--btn-fg: var(--color-primary);
&:is(.dark *) {
--btn-color: color-mix(in oklab, var(--color-primary) 15%, transparent);
--btn-fg: var(--color-primary);
}
}
@utility btn-soft-destructive {
--btn-color: var(--color-destructive);
--btn-fg: var(--color-destructive);
&:is(.dark *) {
--btn-color: color-mix(in oklab, var(--color-destructive) 15%, transparent);
--btn-fg: var(--color-destructive);
}
}
@utility btn-soft-success {
--btn-color: var(--color-success);
--btn-fg: var(--color-success);
&:is(.dark *) {
--btn-color: color-mix(in oklab, var(--color-success) 15%, transparent);
--btn-fg: var(--color-success);
}
}
@utility btn-soft-gray {
--btn-color: var(--color-background);
--btn-fg: var(--color-foreground);
&:is(.dark *) {
--btn-color: color-mix(in oklab, var(--color-muted-foreground) 15%, transparent);
--btn-fg: var(--color-muted-foreground);
}
}
Ghost variants
@utility btn-ghost-gray {
--btn-color: transparent;
--btn-fg: var(--color-foreground);
&:is(.dark *) {
--btn-color: transparent;
--btn-fg: var(--color-muted-foreground);
}
}
@utility btn-ghost-success {
--btn-color: transparent;
--btn-fg: var(--color-success);
&:is(.dark *) {
--btn-color: transparent;
--btn-fg: var(--color-success);
}
}