 Search
components/badge: Badge components/button: Button components/checkbox: Checkbox components/dialog: Dialog components/input: Input components/popover: Popover components/pre: Pre components/radio: Radio components/separator: Separator components/switch: Switch components/table: Table components/textarea: Textarea components/tooltip: Tooltip components/typography: Typography plugins/plugin-nf: Nerd Font Plugin plugins/theme-catppuccin: Catppuccin Theme plugins/theme-gruvbox: Gruvbox Theme plugins/theme-nord: Nord Theme start/changelog: Changelog start/ascii-boxes: ASCII Boxes start/intro: Introduction start/intro: ## Features start/plugins: Plugins start/plugins: ## Official Plugins start/plugins: ### Themes start/plugins: ## Community Plugins contributing/contributing: Contributing contributing/contributing: ## Local Development contributing/contributing: ## Issues contributing/contributing: ## Pull Requests contributing/style-guide: Style Guide contributing/style-guide: ## CSS Units contributing/style-guide: ## Selectors contributing/style-guide: ## Documentation plugins/plugin-dev: Developing Plugins plugins/plugin-dev: ### Style Layers start/tuis-vs-guis: TUIs vs GUIs start/tuis-vs-guis: ## Monospace Fonts start/tuis-vs-guis: ## Character Cells installation/nextjs: Next.js installation/vite: Vite start/theming: Theming start/theming: ## CSS Variables start/theming: ### Font Styles start/theming: ### Colors start/theming: ### Light & Dark start/theming: ## Theme Plugins start/installation: Installation start/installation: ## Installation start/installation: ## Using CSS start/installation: ## Using ESM start/installation: ## Using a CDN start/installation: ## Full Library Import start/installation: ### CSS start/installation: ### ESM start/installation: ### CDN installation/astro: Astro installation/astro: ## Scoping installation/astro: ### Frontmatter Imports installation/astro: ### <style> tag installation/astro: ### Full Library Import

Button

Displays a button

<button>Click Me</button>

Import

@import "@webtui/css/components/button.css";

To add box borders to button, import the Box Utility stylesheet (optional)

@import "@webtui/css/utils/box.css";

Usage

<button>button</button>

Apply is-="button" to any HTML element to style it as a button

<div is-="button">div with button style</div>

Examples

Variants

<button variant-="background0">background0</button>
<button variant-="background1">background1</button>
<button variant-="background2">background2</button>
<button variant-="background3">background3</button>
<button variant-="foreground0">foreground0</button>
<button variant-="foreground1">foreground1</button>
<button variant-="foreground2">foreground2</button>

Available variants match the base theme colors

Box Borders

Requires the Box Utility

<button box-="round">Round</button>
<button box-="square">Square</button>
<button box-="double">Double</button>

Sizes

<button>Default</button>
<button size-="small">Small</button>
<button size-="large">Large</button>

disabled

<button disabled>Disabled</button>

Reference

Properties

  • --button-primary: The primary color of the button
  • --button-secondary: The secondary color of the button
button {
    --button-primary: black;
    --button-secondary: green;
}

Buttons automatically switch between --button-primary and --button-secondary based on whether box- is applied or not

button-colors.png

Extending

To extend the Button stylesheet, define a CSS rule on the components layer

@layer components {
    button, [is-~="button"] {
        &[variant-="red"] {
            --button-primary: red;
            --button-secondary: white;
        }

        /* ... */
    }
}

Scope

button, [is-~="button"] { /* ... */ }