# Form (`.z-input`)

> Styling for native form controls: inputs, selects, textareas, radios, checkboxes, ranges, toggle switches, labels, icons, sizes, and selectable card/field layouts.

- **Kind:** css
- **Category:** inputs

## CSS Variables

| Variable | Default | Scope | Affects | Description |
| --- | --- | --- | --- | --- |
| `--z-form-checkbox-image` | `` | `.z-checkbox:checked` | `background-image` | Background image drawn for a checked checkbox (the check mark). |
| `--z-form-checkbox-image-indeterminate` | `` | `.z-checkbox:indeterminate` | `background-image` | Background image drawn for an indeterminate checkbox (the dash). |
| `--z-form-danger-ring-color` | `var(--z-danger)` | `.z-form-danger:focus` | `outline-color` | Focus ring color for fields marked `.z-form-danger`. |
| `--z-form-danger-ring-color-o` | `100%` | `.z-form-danger:focus` | `outline-color` | Opacity applied to the danger focus ring color. |
| `--z-form-focus-ring-color` | `var(--z-focus)` | `.z-input:focus, .z-select:focus, .z-textarea:focus, .z-input-fake:focus` | `outline`, `outline-color` | Focus ring color for inputs, selects, textareas, and fake inputs. |
| `--z-form-focus-ring-color-o` | `100%` | `.z-input:focus, .z-select:focus, .z-textarea:focus, .z-input-fake:focus` | `outline`, `outline-color` | Opacity applied to the focus ring color. |
| `--z-form-icon-width` | `2.5rem` | `.z-form-icon, .z-input` | `padding-left`, `padding-right`, `width` | Width reserved for a leading or trailing form icon; the input pads itself by this amount. |
| `--z-form-input-bg` | `transparent` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `background-color` | Background color of inputs, selects, textareas, fake inputs, and radio cards. |
| `--z-form-input-border-color` | `var(--z-input)` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `border-color` | Border color of the shared input base. |
| `--z-form-input-border-color-o` | `var(--z-input-o)` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `border-color` | Opacity applied to the input border color. |
| `--z-form-input-color` | `var(--z-bg-f)` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `color` | Text color of the shared input base. |
| `--z-form-input-color-o` | `100%` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `color` | Opacity applied to the input text color. |
| `--z-form-input-font-size` | `var(--z-global-font-size-small)` | `.z-form-xsmall` | `font-size` | Font size of controls; overridden by the small and extra-small size variants. |
| `--z-form-input-height` | `calc(var(--z-global-font-size) * var(--z-interactive-height-multiplier))` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `height` | Computed control height from the global font size and the interactive height multiplier. |
| `--z-form-input-line-height` | `var(--z-global-line-height-small)` | `.z-form-xsmall` | `line-height` | Line height of controls; overridden by the small and extra-small size variants. |
| `--z-form-input-padding` | `var(--z-form-input-padding-block) var(--z-form-input-padding-inline)` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `padding` | Shorthand padding of the shared input base, composed from the block and inline padding variables. |
| `--z-form-input-padding-block` | `calc( var(--z-global-font-size) * var(--z-interactive-padding-block-multiplier) )` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `padding` | Block (vertical) padding of controls, derived from the interactive padding multiplier. |
| `--z-form-input-padding-inline` | `calc( var(--z-global-font-size) * var(--z-interactive-padding-inline-multiplier) )` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `padding` | Inline (horizontal) padding of controls, derived from the interactive padding multiplier. |
| `--z-form-input-radius` | `` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `border-radius` | Corner radius of the shared input base; supplied by the theme. |
| `--z-form-input-shadow` | `` | `.z-input, .z-select, .z-textarea, .z-input-fake, .z-radio-card` | `box-shadow` | Box shadow of the shared input base; supplied by the theme. |
| `--z-form-radio-border-color` | `var(--z-input)` | `.z-radio, .z-checkbox` | `border` | Border color of radios and checkboxes. |
| `--z-form-radio-border-color-o` | `var(--z-input-o)` | `.z-radio, .z-checkbox` | `border` | Opacity applied to the radio/checkbox border color. |
| `--z-form-radio-focus-ring-color` | `var(--z-form-radio-checked-border-color)` | `.z-radio:focus, .z-checkbox:focus` | `outline` | Focus ring color for radios and checkboxes; defaults to the checked border color. |
| `--z-form-radio-focus-ring-color-o` | `30%` | `.z-radio:focus, .z-checkbox:focus` | `outline` | Opacity applied to the radio/checkbox focus ring color. |
| `--z-form-radio-image` | `` | `.z-radio:checked` | `background-image` | Background image drawn for a checked radio (the dot). |
| `--z-form-radio-indeterminate-bg` | `var(--z-muted)` | `.z-checkbox:indeterminate` | `background-color` | Background color of an indeterminate checkbox. |
| `--z-form-radio-indeterminate-bg-o` | `8%` | `.z-checkbox:indeterminate` | `background-color` | Opacity applied to the indeterminate background color. |
| `--z-form-radio-indeterminate-border-color` | `var(--z-muted)` | `.z-checkbox:indeterminate` | `border-color` | Border color of an indeterminate checkbox. |
| `--z-form-radio-indeterminate-border-color-o` | `32%` | `.z-checkbox:indeterminate` | `border-color` | Opacity applied to the indeterminate border color. |
| `--z-form-radio-radius` | `` | `.z-radio, .z-checkbox` | `border-radius` | Corner radius of radios and checkboxes; supplied by the theme (radios override it to a circle). |
| `--z-form-radio-shadow` | `` | `.z-radio, .z-checkbox` | `box-shadow` | Box shadow of radios and checkboxes; supplied by the theme. |
| `--z-form-toggle-switch-shadow` | `` | `.z-toggle-switch` | `box-shadow` | Box shadow of the toggle switch; supplied by the theme. |
| `--z-radio-card-checked-border-color` | `var(--z-bg-f)` | `.z-radio-card` | — | Border color token for a checked radio card, overridden by `.z-form-danger`; currently declared but not consumed by any rule. |
| `--z-radio-card-gap` | `0.5rem` | `.z-radio-card` | `column-gap` | Gap between a radio card's control and its text column. |
| `--z-range-thumb-bg` | `var(--z-bg)` | `.z-range` | `background-color` | Background color of the range thumb. |
| `--z-range-thumb-bg-o` | `100%` | `.z-range` | `background-color` | Opacity applied to the range thumb color. |
| `--z-range-thumb-border-color` | `var(--z-primary)` | `.z-range` | `border`, `border-color` | Border color of the range thumb. |
| `--z-range-thumb-border-color-o` | `50%` | `.z-range` | `border`, `border-color` | Opacity applied to the range thumb border color. |
| `--z-range-thumb-margin-top` | `-7px` | `.z-range` | `margin-top` | Vertical offset that centers the range thumb on the track. |
| `--z-range-thumb-radius` | `500px` | `.z-range` | `border-radius` | Corner radius of the range thumb. |
| `--z-range-thumb-size` | `1rem` | `.z-range` | `height`, `width` | Height and width of the range thumb. |
| `--z-range-track-bg` | `var(--z-primary)` | `.z-range` | `background-color` | Background color of the range track. |
| `--z-range-track-bg-o` | `20%` | `.z-range` | `background-color` | Opacity applied to the range track color. |
| `--z-range-track-height` | `3px` | `.z-range` | `height` | Height of the range track. |
| `--z-range-track-radius` | `500px` | `.z-range` | `border-radius` | Corner radius of the range track. |
| `--z-toggle-field-gap` | `1rem` | `.z-toggle-field` | `column-gap` | Gap between a toggle field's text and its switch. |
| `--z-toggle-switch-bg` | `var(--z-input)` | `.z-toggle-switch` | `background-color` | Background color of the unchecked toggle switch track. |
| `--z-toggle-switch-bg-o` | `var(--z-input-o)` | `.z-toggle-switch` | `background-color` | Opacity applied to the toggle switch track color. |
| `--z-toggle-switch-height` | `1.25rem` | `.z-toggle-switch` | `height` | Height of the toggle switch track. |
| `--z-toggle-switch-knob-bg` | `var(--z-bg)` | `.z-toggle-switch` | `background-color` | Background color of the toggle switch knob. |
| `--z-toggle-switch-knob-bg-o` | `100%` | `.z-toggle-switch` | `background-color` | Opacity applied to the toggle switch knob color. |
| `--z-toggle-switch-width` | `2.25rem` | `.z-toggle-switch` | `width` | Width of the toggle switch track. |

## CSS Classes

| Class | Role | Applies to | Description |
| --- | --- | --- | --- |
| `.z-checkbox` | `element` | `.z-input` | Native checkbox styled as a custom square; the check and indeterminate marks come from background images. |
| `.z-fieldset` | `element` | `.z-input` | Fieldset wrapper with `min-width: 0` so it can shrink inside flex/grid layouts. |
| `.z-form-blank` | `element` | `.z-input` | Removes an input's background, border, and shadow, and suppresses the focus outline. |
| `.z-form-custom` | `element` | `.z-input` | Wrapper that overlays a native `<select>` or file `<input>` transparently on top of custom-styled content. |
| `.z-form-danger` | `modifier` | `.z-input` | Marks a field invalid: switches the focus ring (and radio-card border) to the danger color. |
| `.z-form-help` | `element` | `.z-input` | Small helper text below a field. |
| `.z-form-icon` | `modifier` | `.z-input` | Icon positioned inside an input's leading edge; the input pads itself to make room. |
| `.z-form-icon-flip` | `element` | `.z-input` | Moves the form icon to the trailing edge of the input. |
| `.z-form-label` | `element` | `.z-input` | Field label typography. |
| `.z-form-label-required` | `element` | `.z-input` | Appends a danger-colored asterisk to a required field's label. |
| `.z-form-large` | `modifier` | `.z-input` | Large control size: taller height and larger padding. |
| `.z-form-medium` | `modifier` | `.z-input` | Medium (default) control size. |
| `.z-form-small` | `modifier` | `.z-input` | Small control size with smaller font and line height. |
| `.z-form-stacked` | `element` | `.z-input` | Stacks labels above their fields by making `.z-form-label` block-level. |
| `.z-form-xsmall` | `modifier` | `.z-input` | Extra-small control size with smaller font and line height. |
| `.z-inline` | `element` | `.z-input` | Inline-block wrapper that keeps an input and its icon aligned on one line. |
| `.z-input` | `root` | `.z-input` | Root class for native text inputs; also the shared base style for selects, textareas, fake inputs, and radio cards. |
| `.z-input-fake` | `element` | `.z-input` | Non-input element styled to look like an input, such as a custom select trigger. |
| `.z-radio` | `element` | `.z-input` | Native radio styled as a custom circle; the checked dot comes from a background image. |
| `.z-radio-card` | `modifier` | `.z-input` | Selectable card wrapping a radio/checkbox with a label and description; highlights its border when checked. |
| `.z-radio-card-body` | `element` | `.z-input` | Text column of a radio card, holding the label and description. |
| `.z-radio-card-control` | `element` | `.z-input` | Leading column of a radio card that holds and vertically centers the radio/checkbox. |
| `.z-radio-card-description` | `element` | `.z-input` | Muted description text inside a radio card. |
| `.z-radio-card-label` | `element` | `.z-input` | Label text inside a radio card. |
| `.z-range` | `element` | `.z-input` | Native range slider with a custom track and thumb. |
| `.z-select` | `element` | `.z-input` | Native `<select>` styled to match inputs; single selects drop the native arrow, while `multiple`/`size` selects grow and resize vertically. |
| `.z-textarea` | `element` | `.z-input` | Native textarea styled to match inputs, with a two-line minimum height. |
| `.z-toggle-field` | `element` | `.z-input` | Row pairing a label/description with a toggle switch, spaced apart and clickable as a whole. |
| `.z-toggle-field-body` | `element` | `.z-input` | Text column of a toggle field, holding the label and description. |
| `.z-toggle-field-control` | `element` | `.z-input` | Trailing column of a toggle field that holds and centers the switch. |
| `.z-toggle-field-description` | `element` | `.z-input` | Muted description text inside a toggle field. |
| `.z-toggle-field-label` | `element` | `.z-input` | Label text inside a toggle field. |
| `.z-toggle-switch` | `element` | `.z-input` | Checkbox styled as a sliding toggle switch. |
| `.z-toggle-switch-danger` | `element` | `.z-input` | Colors the checked toggle switch with the danger color. |
| `.z-toggle-switch-primary` | `element` | `.z-input` | Colors the checked toggle switch with the primary color. |

## Accessibility

> Radio cards and toggle fields wrap their native control in a clickable row, so the label activates the control; a disabled control dims the whole row.

> The asterisk added by `.z-form-label-required` is visual only; set the native `required` attribute for semantics.

## Notes

- These classes style native controls; the custom `z-select` dropdown and the `input-*` web components are separate components.
- Control sizes (`.z-form-xsmall` through `.z-form-large`) work by overriding the global `--z-interactive-*-multiplier` tokens, which recompute the input height and padding.
- Radio/checkbox marks, input radius and shadow, and the toggle-switch shadow are theme hooks (`--z-form-*-image`, `--z-form-input-radius`, `--z-form-input-shadow`, `--z-form-toggle-switch-shadow`) supplied outside this file.

## 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)
