# Button (`.z-button`)

> Styled button classes with color schemes, outline/ghost/text variants, four sizes, and icon-only and grouped layouts.

- **Kind:** css
- **Category:** general

## CSS Variables

| Variable | Default | Scope | Affects | Description |
| --- | --- | --- | --- | --- |
| `--z-button-bg` | `var(--z-bg)` | `.z-button` | `background-color` | Background color of the button. |
| `--z-button-bg-o` | `100%` | `.z-button` | `background-color` | Opacity applied to the background color. |
| `--z-button-border` | `var(--z-border)` | `.z-button` | `border-color` | Border color. |
| `--z-button-border-o` | `var(--z-border-o)` | `.z-button` | `border-color` | Opacity applied to the border color. |
| `--z-button-color` | `var(--z-bg-f)` | `.z-button` | `color` | Text and icon color. |
| `--z-button-disabled-o` | `50%` | `.z-button` | `opacity` | Opacity of disabled buttons. |
| `--z-button-font-size` | `var(--z-global-font-size)` | `.z-button` | `font-size` | Label font size. |
| `--z-button-font-weight` | `500` | `.z-button` | `font-weight` | Label font weight. |
| `--z-button-height` | `calc(var(--z-global-font-size) * var(--z-interactive-height-multiplier))` | `.z-button` | `height` | Button height, derived from the font size and the interactive height multiplier. |
| `--z-button-hover-bg` | `var(--z-accent)` | `.z-button` | `background-color` | Background color on hover. |
| `--z-button-hover-bg-o` | `4%` | `.z-button` | `background-color` | Opacity applied to the hover background color. |
| `--z-button-hover-color` | `var(--z-accent-f)` | `.z-button` | `color` | Text and icon color on hover. |
| `--z-button-icon-size` | `1rem` | `.z-button` | `height`, `width` | Width and height of icons inside the button. |
| `--z-button-line-height` | `var(--z-global-line-height)` | `.z-button` | `line-height` | Label line height. |
| `--z-button-padding` | `var(--z-button-padding-block) var(--z-button-padding-inline)` | `.z-button` | `padding` | Shorthand padding assembled from the block and inline padding variables. |
| `--z-button-padding-block` | `calc( var(--z-global-font-size) * var(--z-interactive-padding-block-multiplier) )` | `.z-button` | `padding` | Vertical padding; feeds `--z-button-padding`. |
| `--z-button-padding-inline` | `calc( var(--z-global-font-size) * var(--z-interactive-padding-inline-multiplier) )` | `.z-button` | `padding` | Horizontal padding; feeds `--z-button-padding`. |
| `--z-button-radius` | `var(--z-global-radius)` | `.z-button` | `border-end-end-radius`, `border-end-start-radius`, `border-radius`, `border-start-end-radius`, `border-start-start-radius` | Corner radius. |
| `--z-button-shadow` | `var(--z-global-shadow-small)` | `.z-button` | `box-shadow` | Box shadow. |

## CSS Classes

| Class | Role | Applies to | Description |
| --- | --- | --- | --- |
| `.z-button` | `root` | `.z-button` | Base class for styled buttons and button-like links. |
| `.z-button-danger` | `modifier` | `.z-button` | Danger color scheme with white text. |
| `.z-button-default` | `modifier` | `.z-button` | Neutral surface color scheme. |
| `.z-button-ghost` | `modifier` | `.z-button` | Transparent background and border with no shadow; an accent tint appears on hover. |
| `.z-button-group` | `element` | `.z-button` | Joins adjacent buttons into one segmented unit with shared radius and shadow. |
| `.z-button-icon` | `element` | `.z-button` | Square icon-only button with no padding. |
| `.z-button-info` | `modifier` | `.z-button` | Info color scheme with white text. |
| `.z-button-large` | `modifier` | `.z-button` | Large size: taller height and wider padding. |
| `.z-button-medium` | `modifier` | `.z-button` | Medium size. |
| `.z-button-outline` | `modifier` | `.z-button` | Transparent background with colored border and text; combines with the color schemes. |
| `.z-button-primary` | `modifier` | `.z-button` | Primary color scheme. |
| `.z-button-secondary` | `modifier` | `.z-button` | Subtle secondary color scheme with a faint tinted background. |
| `.z-button-small` | `modifier` | `.z-button` | Small size with reduced font and padding. |
| `.z-button-success` | `modifier` | `.z-button` | Success color scheme with white text. |
| `.z-button-text` | `modifier` | `.z-button` | Inline text button with an animated underline and no background, border, or padding. |
| `.z-button-warning` | `modifier` | `.z-button` | Warning color scheme with white text. |
| `.z-button-xsmall` | `modifier` | `.z-button` | Extra-small size with reduced font and padding. |

## Notes

- Buttons are plain elements styled by class; there is no custom element or JavaScript API.
- Size classes adjust the interactive height and padding multipliers; xsmall and small also switch to the small global font size.

## Guides

- [Styling with cls and stl](https://next.0build.dev/docs/guides/styling.md)
- [Translating Components](https://next.0build.dev/docs/guides/i18n.md)
- [Icon Resolution](https://next.0build.dev/docs/guides/icons.md)
- [The data-source Convention](https://next.0build.dev/docs/guides/data-source.md)
- [Openers & Triggers](https://next.0build.dev/docs/guides/triggers.md)
- [Dialog Behavior](https://next.0build.dev/docs/guides/dialogs.md)
- [Utilities](https://next.0build.dev/docs/guides/utilities.md)
- [Runtime](https://next.0build.dev/docs/guides/runtime.md)
