Skip to content

Button


View Source 

Usage

css
@import "winduum/src/components/button/index.css" layer(components);

Variants

  • default 
  • interactive 

Props

  • default 
  • interactive 

Tokens

  • bordered
  • muted
  • raised
  • ghosted
  • sm
  • lg
  • square
  • circle
  • fill

Installation

Follow instructions for individual framework usage below

  • winduum 
  • winduum-vue 
  • winduum-react 
  • winduum-stimulus 

Examples

Basic

html
<button class="x-button">Button</button>
<button class="x-button rounded-full">Button</button>
vue
<script setup lang="ts">
    import { Button } from '@/components/button'
</script>

<template>
  <Button>Button</Button>
  <Button class="rounded-full">Button</Button>
</template>
jsx
import { Button } from "@/components/button"

export function Example() {
    return (
        <>
            <Button>Button</Button>
            <Button className="rounded-full">Button</Button>
        </>
    )
}

Flat

html
<button class="x-button accent-primary">Primary</button>
<button class="x-button accent-main">Main</button>
<button class="x-button accent-success">Success</button>
<button class="x-button accent-error">Error</button>
<button class="x-button accent-warning">Warning</button>
<button class="x-button accent-info">Info</button>
<button class="x-button accent-dark">Dark</button>
<button class="x-button accent-light text-dark">Light</button>

Bordered

html
<button class="x-button bordered accent-primary">Primary</button>
<button class="x-button bordered accent-main">Main</button>
<button class="x-button bordered accent-success">Success</button>
<button class="x-button bordered accent-error">Error</button>
<button class="x-button bordered accent-warning">Warning</button>
<button class="x-button bordered accent-info">Info</button>
<button class="x-button bordered accent-dark">Dark</button>
<button class="x-button bordered accent-light">Light</button>

Muted

html
<button class="x-button muted accent-primary">Primary</button>
<button class="x-button muted accent-main">Main</button>
<button class="x-button muted accent-success">Success</button>
<button class="x-button muted accent-error">Error</button>
<button class="x-button muted accent-warning">Warning</button>
<button class="x-button muted accent-info">Info</button>
<button class="x-button muted accent-dark">Dark</button>
<button class="x-button muted accent-light">Light</button>

Raised

html
<button class="x-button raised accent-primary">Primary</button>
<button class="x-button raised accent-main">Main</button>
<button class="x-button raised accent-success">Success</button>
<button class="x-button raised accent-error">Error</button>
<button class="x-button raised accent-warning">Warning</button>
<button class="x-button raised accent-info">Info</button>
<button class="x-button raised accent-dark">Dark</button>
<button class="x-button raised accent-light text-dark">Light</button>

Ghosted

html
<button class="x-button ghosted accent-primary">Primary</button>
<button class="x-button ghosted accent-main">Main</button>
<button class="x-button ghosted accent-success">Success</button>
<button class="x-button ghosted accent-error">Error</button>
<button class="x-button ghosted accent-warning">Warning</button>
<button class="x-button ghosted accent-info">Info</button>
<button class="x-button ghosted accent-dark">Dark</button>
<button class="x-button ghosted accent-light">Light</button>

Small

html
<button class="x-button sm">Button</button>

Large

html
<button class="x-button lg">Button</button>

Square

html
<button class="x-button square">1</button>
<button class="x-button square outline">2</button>
<button class="x-button square muted">
    <svg fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" d="M6 13.5V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m12-3V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m-6-9V3.75m0 3.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 9.75V10.5" />
    </svg>
</button>

Circle

html
<button class="x-button circle">1</button>
<button class="x-button circle bordered">2</button>
<button class="x-button circle muted">
    <svg fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" d="M6 13.5V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m12-3V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m-6-9V3.75m0 3.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 9.75V10.5" />
    </svg>
</button>

Icon

html
<button class="x-button muted">
    <svg fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" d="M6 13.5V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m12-3V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m-6-9V3.75m0 3.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 9.75V10.5" />
    </svg>
    Button
</button>
<button class="x-button bordered">
    Button
    <svg>
        <use href="#icon-adjustments-vertical"></use>
    </svg>
</button>
<button class="x-button square">
    <svg>
        <use href="#icon-adjustments-vertical"></use>
    </svg>
</button>
<svg hidden>
    <symbol id="icon-adjustments-vertical" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" d="M6 13.5V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m12-3V3.75m0 9.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 3.75V16.5m-6-9V3.75m0 3.75a1.5 1.5 0 010 3m0-3a1.5 1.5 0 000 3m0 9.75V10.5" />
    </symbol>
</svg>

Loading

html
<button class="x-button" data-loading>
    Button
    <span class="spinner spinner-absolute"></span>
</button>
<button class="x-button muted" data-loading>
    Button
    <span class="spinner spinner-absolute"></span>
</button>
<button class="x-button bordered" data-loading>
    <span class="spinner spinner-circle"></span>
    Loading
</button>

Active

html
<button class="x-button active">
    Button
</button>
<button class="x-button muted active">
    Button
</button>
<button class="x-button bordered active">
    Button
</button>

Disabled

html
<button class="x-button" disabled>
    Button
</button>
<button class="x-button muted" disabled>
    Button
</button>
<button class="x-button bordered" disabled>
    Button
</button>

Custom

html
<button class="x-custom">Button</button>
css
.x-custom {
  --color-accent: yellow;
  --color-accent-foreground: #333;
  --x-button-block-size: 4rem;
  --x-button-padding-block: 1rem;
  --x-button-padding-inline: 1rem;
  --x-button-border-radius: 0;
  --x-button-font-size: 1.15rem;
  --x-button-font-weight: 700;
  --x-button-hover-opacity: 40%;
  --x-button-focus-opacity: 80%;
}

You can also extend the button with any TailwindCSS class to customize it

html
<button class="x-button bg-gray-200 text-dark">Button</button>

Group

You can group buttons into groups via x-group component.

html
<div class="x-group">
    <button class="x-button">Button</button>
    <button class="x-button">Button</button>
    <button class="x-button">Button</button>
</div>
<div class="x-group">
    <button class="x-button outline">Button</button>
    <button class="x-button outline">Button</button>
    <button class="x-button outline">Button</button>
</div>
<div class="x-group">
    <button class="x-button muted">Button</button>
    <button class="x-button muted">Button</button>
    <button class="x-button muted">Button</button>
</div>

Custom Props

default

CSS propertyDefault value
--x-button-inline-sizeinitial
--x-button-block-size2.25rem
--x-button-padding-block0.375rem
--x-button-padding-inline0.75rem
--x-button-border-radiusvar(--radius, 0.75rem)
--x-button-font-familyinitial
--x-button-font-sizevar(--font-size-sm, 0.875rem)
--x-button-font-weightvar(--font-weight-medium, 500)
--x-button-letter-spacinginitial
--x-button-background-color-spacesrgb
--x-button-background-colorvar(--color-accent)
--x-button-background-color-opacity100%
--x-button-background-color-mixtransparent
--x-button-color-spacesrgb
--x-button-colorvar(--color-accent-foreground)
--x-button-color-opacity100%
--x-button-color-mixtransparent
--x-button-border-width0px
--x-button-border-color-spacesrgb
--x-button-border-colorvar(--color-accent)
--x-button-border-color-opacity100%
--x-button-border-color-mixtransparent
--x-button-outline-width2px
--x-button-outline-color-spacesrgb
--x-button-outline-colortransparent
--x-button-outline-color-opacity100%
--x-button-outline-color-mixtransparent
--x-button-outline-offsetinitial
--x-button-gapvar(--spacing-2, 0.5rem)

interactive

CSS propertyDefault value
--x-button-transition-propertyvar(--default-transition-property)
--x-button-timing-functionvar(--transition-timing-function-in-out)
--x-button-transition-durationvar(--default-transition-duration)
--x-button-hover-background-colorvar(--color-accent)
--x-button-hover-background-color-mixvar(--color-dark)
--x-button-hover-background-color-opacity80%
--x-button-hover-border-colorvar(--color-accent)
--x-button-hover-border-color-mixtransparent
--x-button-hover-border-color-opacity100%
--x-button-hover-colorvar(--color-accent-foreground)
--x-button-hover-color-mixtransparent
--x-button-hover-color-opacity100%
--x-button-focus-outline-offset2px
--x-button-focus-outline-colorvar(--color-accent)
--x-button-focus-outline-color-opacity50%
--x-button-active-background-colorvar(--color-accent)
--x-button-active-background-color-mixvar(--color-dark)
--x-button-active-background-color-opacity90%
--x-button-active-border-colorvar(--color-accent)
--x-button-active-border-color-mixtransparent
--x-button-active-border-color-opacity100%
--x-button-active-colorvar(--color-accent-foreground)
--x-button-active-color-mixtransparent
--x-button-active-color-opacity100%
--x-button-disabled-background-colorvar(--color-accent)
--x-button-disabled-background-color-mixtransparent
--x-button-disabled-background-color-opacity50%
--x-button-disabled-border-colorvar(--color-accent)
--x-button-disabled-border-color-mixtransparent
--x-button-disabled-border-color-opacity50%
--x-button-disabled-colorvar(--color-accent-foreground)
--x-button-disabled-color-mixtransparent
--x-button-disabled-color-opacity50%

Released under the MIT License.