 Search
components/accordion: Accordion components/badge: Badge components/button: Button components/checkbox: Checkbox components/dialog: Dialog components/input: Input components/mark: Mark components/popover: Popover components/pre: Pre components/progress: Progress components/radio: Radio components/separator: Separator components/spinner: Spinner components/range: Range components/switch: Switch components/table: Table components/tooltip: Tooltip components/textarea: Textarea components/typography: Typography components/view: View plugins/plugin-declarative-layout: Declarative Layout plugins/plugin-nf: Nerd Font Plugin plugins/theme-catppuccin: Catppuccin Theme plugins/theme-everforest: Everforest Theme 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 contributing/contributing: Contributing contributing/contributing: ## Local Development contributing/contributing: ## Issues contributing/contributing: ## Pull Requests installation/nextjs: Next.js installation/vite: Vite installation/astro: Astro installation/astro: ## Scoping installation/astro: ### Frontmatter Imports installation/astro: ### <style> tag installation/astro: ### Full Library Import plugins/theme-gruvbox: Gruvbox Theme plugins/theme-osmium: Osmium Theme plugins/theme-nord: Nord Theme plugins/theme-vitesse: Vitesse Theme start/ascii-boxes: ASCII Boxes start/changelog: Changelog start/installation: Installation start/intro: Introduction start/intro: ## Features 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/theming: ### Using Multiple Theme Accents start/tuis-vs-guis: TUIs vs GUIs start/tuis-vs-guis: ## Monospace Fonts start/tuis-vs-guis: ## Character Cells

Checkbox

Displays a checkbox

1 <label>
2 <input type="checkbox" is-="checkbox" />
3 Unchecked
4 </label>
5 <label>
6 <input type="checkbox" is-="checkbox" checked />
7 Checked
8 </label>

Import

@import '@webtui/css/components/checkbox.css';

Usage

Both type="checkbox" and is-="checkbox" are necessary because the switch component is also a checkbox under the hood

<label>
    <input type="checkbox" is-="checkbox" />
    Checkbox
</label>

Examples

disabled

1
2 <label>
3 <input type="checkbox" is-="checkbox" disabled />
4 Disabled
5 </label>
6 <label>
7 <input type="checkbox" is-="checkbox" checked disabled />
8 Checked Disabled
9 </label>
10

Reference

Properties

  • --placeholder-content: The content of the checkbox placeholder
  • --placeholder-background: The background color of the checkbox placeholder
  • --placeholder-color: The text color of the checkbox placeholder
  • --checked-content: The content of the checkbox when checked
  • --checked-background: The background color of the checkbox when checked
  • --checked-color: The text color of the checkbox when checked
1
2 <label>
3 <input type="checkbox" is-="checkbox" />
4 Default
5 </label>
6 <label>
7 <input type="checkbox" is-="checkbox" checked />
8 Default Checked
9 </label><br/>
10 <label>
11 <input type="checkbox" is-="checkbox" class="custom" />
12 Custom
13 </label>
14 <label>
15 <input type="checkbox" is-="checkbox" checked class="custom" />
16 Custom Checked
17 </label>
18
1
2 input[type='checkbox'][is-='checkbox'].custom {
3 --placeholder-content: '( )';
4 --placeholder-background: var(--background2);
5 --placeholder-color: var(--foreground1);
6 --checked-content: 'X';
7 --checked-color: red;
8 }
9

Extending

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

@layer components {
    input[type='checkbox'][is-='checkbox'] {
        /* ... */
    }
}

Scope

  • All native <input type="checkbox"> elements with is-="checkbox"
input[type='checkbox'][is-='checkbox'] {
    /* ... */
}