 Search
guides/style-guide: Style Guide guides/style-guide: ## Box Model guides/style-guide: ## Text plugins/plugin-dev: Developing Plugins plugins/plugin-dev: ### Style Layers components/input: Input components/input: ## Import components/input: ## Usage components/input: ### box- components/input: ### size- components/input: ### Extending plugins/plugin-nf: Nerd Font Plugin plugins/plugin-nf: ## Installation plugins/plugin-nf: ## Install a Nerd Font plugins/plugin-nf: ### Static Font plugins/plugin-nf: ### CDN plugins/plugin-nf: ## Components plugins/plugin-nf: ### <details> plugins/plugin-nf: ### Badge plugins/plugin-nf: #### cap- components/badge: Badge components/badge: ## Import components/badge: ## Usage components/badge: ### variant- components/badge: ### Styling components/badge: ### Extending components/badge: ## Scope start/ascii-boxes: ASCII Boxes start/ascii-boxes: ## Usage start/ascii-boxes: ## Border Types start/ascii-boxes: ## Containment start/ascii-boxes: ## Custom Properties start/ascii-boxes: ### --box-border-color start/ascii-boxes: ### --box-rounded-radius start/ascii-boxes: ### --box-border-width start/ascii-boxes: ### --box-double-border-width plugins/theme-nord: Nord Theme plugins/theme-nord: ## Installation plugins/theme-nord: ## Components plugins/theme-nord: ### Typography plugins/theme-nord: ### Badge plugins/theme-nord: ### Button plugins/theme-nord: ## CSS Variables components/button: Button components/button: ## Import components/button: ## Usage components/button: ### box- components/button: ### variant- components/button: ### size- components/button: ### disabled components/button: ### Styling components/button: ### Extending components/button: ## Scope plugins/theme-catppuccin: Catppuccin Theme plugins/theme-catppuccin: ## Installation plugins/theme-catppuccin: ## Flavors plugins/theme-catppuccin: ## Components plugins/theme-catppuccin: ### Typography plugins/theme-catppuccin: ### Badge plugins/theme-catppuccin: ### Button plugins/theme-catppuccin: ## CSS Variables plugins/theme-gruvbox: Gruvbox Theme plugins/theme-gruvbox: ## Installation plugins/theme-gruvbox: ## Variants plugins/theme-gruvbox: ## Components plugins/theme-gruvbox: ### Typography plugins/theme-gruvbox: ### Badge plugins/theme-gruvbox: ### Button plugins/theme-gruvbox: ## CSS Variables components/typography: Typography components/typography: ## Import components/typography: ## Usage components/typography: ### <h1>-<h6> components/typography: ### <p> components/typography: ### <blockquote> components/typography: ### <ol> components/typography: ### <ul> components/typography: #### <ul> Markers components/typography: ### [is-="typography-block"] components/typography: ## Scope start/intro: Introduction start/intro: ## Features start/installation: Installation start/installation: ## Installation start/installation: ## ESM Imports start/installation: ## CDN Imports start/installation: ## Full Library Import start/plugins: Plugins start/plugins: ## Official Plugins start/plugins: ### Themes start/plugins: ## Community Plugins start/theming: Theming start/theming: ## CSS Variables start/theming: ### Font Styles start/theming: ### Colors start/theming: ### Light & Dark start/theming: ## Theme Plugins start/tuis-vs-guis: TUIs vs GUIs start/tuis-vs-guis: ## Monospace Fonts start/tuis-vs-guis: ## Character Cells

Button

Import

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

The Box Utility can be used to add box borders to buttons

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

Usage

Create a <button> element, or add is-="button" to any HTML element

<button>Normal button</button>
<div is-="button">Div Button</div>

box-

Use the box- attribute to add a box border a button (requires the box utility)

<button box-="round">Round</button>
<button box-="square">Square</button>
<button box-="double">Double</button>
 button-boxes.png

button-boxes.png

variant-

Use the variant- attribute to change the color of a button

Available variants match the base theme colors

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

size-

Use the size- attribute to change the size of a button

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

disabled

Use the disabled attribute to mark a button as disabled

<button disabled>Disabled</button>

Styling

Buttons are styled using the custom --button-primary and --button-secondary CSS properties

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

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"] { /* ... */ }