NativeSelect

The platform <select> with Merid styling. You get the full native keyboard, the operating system's picker on mobile and form participation without any JavaScript.

StableSource

Import

tsx
import { NativeSelect } from "@merid/react";

Examples

Sizes

sm is 36px, md 46px (default) and lg 50px — the same heights as Input, so they line up in a row.

In a Field

Inside a Field the select picks up its id, aria-describedby, required and disabled from context — no manual wiring.

You can change plans at any time.

Invalid and disabled

A Field error sets aria-invalid on the select and links the message. Outside a Field pass invalid directly.

Pick a region to continue.

Controlled

Use value and onChange exactly as with a native select.

Current value: weekly

API reference

The ref and all native select attributes go to the <select>, except className and style, which are applied to the outer wrapper. The native size attribute is replaced by the size prop below.

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"Height: sm 36px, md 46px, lg 50px.
invalidboolean–Forces the invalid style (`data-invalid`) and `aria-invalid`. Inside a Field, derived from its error.
placeholderstring–Adds a disabled, hidden `value=""` first option, shown whenever the value is `""` (uncontrolled start or a controlled `value=""`).
childrenReactNode–option and optgroup elements.

Styling

HookValues
.mrd-native-selectWrapper <span>; receives className and style
.mrd-native-select__controlThe <select>
.mrd-native-select__chevronDecorative chevron icon
data-sizesm · md · lg (on the wrapper)
data-invalidOn the control when invalid; drives the danger border (aria-invalid carries the semantics)

Component variable: --mrd-input-height, shared with Input.

Accessibility

  • It is a real <select>, so screen readers announce it as a combobox or list box with its options, and mobile browsers open the native picker.
  • Give it a name: a surrounding Field, a Label with htmlFor, or aria-label. The placeholder option is not a label.
KeyAction
TabMoves focus to the select.
SpaceOpens the option list (platform dependent).
↑↓Changes the selected option.
A–ZJumps to the first option starting with the typed character.

Guidelines

Do

Use NativeSelect for plain lists of known options, especially in forms used on phones.

Avoid

Put rich content, icons or search inside it — reach for Select instead.

Do

Use a placeholder that prompts a choice, like “Select a plan”, when there is no sensible default.

Avoid

Rely on the placeholder as the only label.

  • Select — custom listbox with richer options.
  • Field — label, description and error wiring.
  • Input — single-line text with the same sizes.
  • SegmentedControl — for two to five visible options.