# Styling Native Form Controls in 2026: appearance: base-select, OTP Inputs, and Validation

> How to keep real <select>, <input>, and form validation semantics while delivering modern dark/light control styling.

- Category: Web Platform · Published: 2026-10-22 · Updated: 2026-11-19 · Reading time: 9 min read
- Canonical URL: https://hazeui.com/guides/css-customizable-select-and-native-form-controls
- Tags: forms, base-select, otp-input, validation, accessibility

## Executive Summary

Modern CSS lets you style native form controls without re-implementing keyboard navigation, autofill, or mobile pickers in JavaScript. Haze UI pairs @supports (appearance: base-select) for custom <select> popups, single-input overlays for six-digit OTP verification, forced-colors-safe checkboxes and switches, and native Constraint Validation error summaries.

Custom JavaScript form widgets are famous for failing quietly on real devices. A custom dropdown built out of `<div>` elements loses type-ahead on iOS VoiceOver. Six separate `<input maxlength="1">` boxes break SMS autofill and clipboard paste. A hand-rolled checkbox forgets Windows Forced Colors Mode and disappears for users with low vision.

You get cleaner accessibility—and dramatically less code—when real native `<input>`, `<select>`, and `<form>` elements stay in charge of state, autofill, and form submission.

Here is how Haze UI styles modern form controls without replacing HTML semantics.

## Customizing native `<select>` with `appearance: base-select`

For twenty years, `<select>` popups resisted styling across browsers. Now `appearance: base-select` (combined with `::picker(select)`, `::checkmark`, and `::picker-icon`) lets CSS style the open dropdown list directly inside the top layer using the exact same design tokens as your popover menus.

Inside `src/styles/haze.css`, Haze UI activates this inside a progressive `@supports` block:

```css
@supports (appearance: base-select) {
  select, ::picker(select) {
    appearance: base-select !important;
  }
  ::picker(select) {
    margin-block: 4px;
    padding: 4px;
    max-height: min(20rem, 60vh);
    border-radius: var(--radius-lg);
    background-color: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-float);
    transition: opacity 150ms var(--ease-snappy),
                translate 150ms var(--ease-snappy),
                display 150ms allow-discrete,
                overlay 150ms allow-discrete;
  }
  @starting-style {
    select:open::picker(select) {
      opacity: 0;
      translate: 0 -4px;
    }
  }
}
```

Meanwhile, [Select](/ui/select) adds `[&::picker-icon]:hidden` on the `<select>` itself so its custom Lucide `ChevronDown` icon stays consistent between browsers that support `base-select` and those falling back to native OS menus.

| Need | Use this Haze UI entry | Underlying DOM pattern |
|---|---|---|
| **Standard 3–15 item form picklist** | [Select](/ui/select) | Native `<select>` + `base-select` progressive enhancement |
| **Searchable list with descriptions** | [Morph Select](/ui/morph-select) | Popover + filtered options + native form input |
| **Country code + phone formatting** | [Phone Input](/ui/phone-input) | Real `<select>` value + searchable country popover |
| **Six-digit MFA / SMS verification** | [OTP Input](/ui/otp-input) | Single `one-time-code` `<input>` + visual digit slots |
| **Boolean toggles & switches** | [Checkbox](/ui/checkbox) & [Switch](/ui/switch) | Native `<input type="checkbox">` + `forced-colors:appearance-auto` |

## Why single-input OTP beats six separate `<input>` elements

Split-box OTP inputs look great in design files and feel miserable when users try to paste `"482 910"` from an email or tap an iOS keyboard SMS suggestion. Six independent inputs force you to manually intercept `keydown`, move focus on Backspace, slice pasted strings across inputs, and re-concatenate values before form submission.

[OTP Input](/ui/otp-input) flips that architecture inside out:

1. **Without JavaScript**, the user sees a clean, monospaced numeric `<input id={id} name={name} autocomplete="one-time-code" inputmode="numeric" maxlength={digits}>`. It works with HTML forms immediately.
2. **With progressive JS**, the parent sets `data-enhanced`, draws six visual `<span>` slots (`data-otp-slot`) with an optional center dash (`separator`), and stretches the real `<input>` invisibly (`opacity-0 inset-0`) over top of the slots.

Because there is still **only one real `<input>`**:

- Browser SMS autofill (`autocomplete="one-time-code"`) drops all six digits straight in.
- Selecting and deleting or pasting `"48-29-10"` strips non-digits cleanly and fills every slot in one pass.
- Mouse clicks on a specific visual slot calculate the nearest slot boundary and place the caret accurately via `setSelectionRange`.
- Form submission sends a single `name=482910` field with zero hidden mirror inputs.

## Checkboxes and switches that respect Forced Colors Mode

Custom-drawn checkboxes (`appearance-none`) solve dark/light visual alignment, yet introducing `appearance-none` creates a classic accessibility trap in Windows High Contrast / Forced Colors Mode: the custom border and background tint vanish unless you explicitly restore native OS appearance.

Look at how [Checkbox](/ui/checkbox) and [Switch](/ui/switch) prevent this:

- Keep the real `<input type="checkbox">` (with `role="switch"` on switches).
- Add `forced-colors:appearance-auto` to the `<input>` class list.
- Hide the custom SVG check/minus mark or CSS thumb using `forced-colors:hidden` / `forced-colors:before:hidden`.
- When disabled (`has-[:disabled]`), dim the control box and label (`opacity-50`), **never** the helper description paragraph—keeping helper copy legible above WCAG AA contrast thresholds (4.5:1) as noted in `DECISIONS.md`.

```astro
---
import Checkbox from "../components/haze/ui/checkbox.astro";
import Switch from "../components/haze/ui/switch.astro";
---

<Checkbox
  id="accept-terms"
  label="Send release notes for installed components"
  description="Monthly summary only. Unsubscribe with one click."
  required
/>
<Switch
  id="single-key"
  label="Single-key keyboard shortcuts"
  description="Turn off if shortcuts conflict with assistive tools."
  checked
/>
```

## Quiet field focus vs. error validation states

One subtle detail makes form-heavy UIs feel calm instead of jittery: in Chromium, text fields (`<input>`, `<textarea>`) match `:focus-visible` on **mouse clicks** as well as keyboard Tab presses. Putting a heavy `outline-2` white ring around every text box makes clicking into a search bar look loud and boxed in.

Haze UI uses a split focus strategy verified across [Input](/ui/input), [Input Group](/ui/input-group), and [Form](/ui/form):

- **Buttons, checkboxes, switches, and links**: `focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring` (appears on keyboard focus only).
- **Text inputs and `<select>`**: `focus-visible:border-ring focus-visible:outline-hidden` (a clean 1 px border shift with no bulky ring).
- **Composite wrappers (`Input Group`)**: `has-[:is(input,textarea):focus-visible]:border-ring` rather than `focus-within:`, so clicking an inline copy or reveal-password button inside the field wrapper doesn't light up the entire field border!
- **Invalid state**: `aria-invalid:border-destructive!` paired with visible error text linked via `aria-describedby`, plus [Form](/ui/form) for an accessible top error summary connected to native browser Constraint Validation.

Next, learn how the color math behind `--input`, `--border-control`, `--ring`, and dark/light surfaces stays accessible in [Tailwind CSS v4 Design Tokens with OKLCH](/guides/tailwind-v4-oklch-design-tokens-dark-light-mode).

## Mentioned Haze UI Entries

- [Select](https://hazeui.com/ui/select.md): Native select with the same field finish as the input, a chevron over the right edge and an optional disabled placeholder option.
- [Input](https://hazeui.com/ui/input.md): Single-line text field with a soft border on a filled background, a muted placeholder, and a stronger border plus ring on focus.
- [Checkbox](https://hazeui.com/ui/checkbox.md): A native checkbox with a label, optional description, and a mixed state for partially selected groups.
- [Switch](https://hazeui.com/ui/switch.md): On/off toggle drawn on a native checkbox with role=switch: a 36 by 20 px track and a sliding thumb, with label and description.
- [Verification code input](https://hazeui.com/ui/otp-input.md): A row of digit slots for a fixed-length code, backed by one real numeric input for paste, autofill and screen readers.
- [Form](https://hazeui.com/ui/form.md): A form wrapper that replaces native validation bubbles with an error summary, linked to each invalid field and its inline message.
- [Morph select](https://hazeui.com/ui/morph-select.md): A native form select enhanced into an anchored, searchable choice panel with a moving selected label.
- [Phone input](https://hazeui.com/ui/phone-input.md): Country calling codes and a real telephone field with progressive international normalization and length feedback.

## Frequently Asked Questions

### Why does Haze UI's OTP Input use one <input> instead of six separate boxes?

Rendering one transparent <input autocomplete='one-time-code' inputmode='numeric'> stretched over six styled visual slots ensures iOS/macOS SMS autofill, password manager fills, and multi-digit clipboard paste work reliably without splitting characters across separate DOM nodes.

### How do custom checkboxes and switches behave in Windows High Contrast Mode?

Haze UI checkboxes and switches combine appearance-none for custom dark/light visuals with forced-colors:appearance-auto and forced-colors:hidden on decorative check icons, so Forced Colors Mode restores high-contrast system controls automatically.

### When should I pick Morph Select instead of native Select?

Use native Select for short lists of options inside forms. Switch to Morph Select or Combobox when users need live type-ahead search, option descriptions, or large lists.
