# Native select

A platform-native selection menu with help text and validation.

Access: pro. Category: Forms. Kind: primitive.

## When to use

- Use it when a product interface needs a platform-native selection menu with help text and validation.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose select-menu instead when rich option content and consistent cross-platform presentation are required.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Native select

```sh
npx shadcn@latest add @tidal-pro/native-select
```

Stylesheets: `components/ui/tidal.css`, `components/ui/native-select.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/native-select.css";
import{TidalNativeSelect}from"./components/ui/native-select";
export default()=><div className="tidal-scope"><TidalNativeSelect children={"value"} label={"Demo"}/></div>;
```

## Structured props

- `TidalNativeSelect.children: ReactNode`: Required children value accepted by this exported component.
- `TidalNativeSelect.label: ReactNode`: Required label value accepted by this exported component.
- `TidalNativeSelect.aria-disabled?: Booleanish | undefined`: Accessible disabled supplied by the consumer.
- `TidalNativeSelect.aria-invalid?: boolean | "true" | "false" | "grammar" | "spelling" | undefined`: Accessible invalid supplied by the consumer.
- `TidalNativeSelect.defaultValue?: string | number | undefined`: Optional default value value accepted by this exported component.
- `TidalNativeSelect.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalNativeSelect.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalNativeSelect.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalNativeSelect.onChange?: ChangeEventHandler<HTMLSelectElement, HTMLSelectElement> | undefined`: Callback invoked when the change interaction is proposed.
- `TidalNativeSelect.onInput?: InputEventHandler<HTMLSelectElement> | undefined`: Callback invoked when the input interaction is proposed.
- `TidalNativeSelect.onKeyDown?: KeyboardEventHandler<HTMLSelectElement> | undefined`: Callback invoked when the key down interaction is proposed.
- `TidalNativeSelect.onPointerDown?: PointerEventHandler<HTMLSelectElement> | undefined`: Callback invoked when the pointer down interaction is proposed.
- `TidalNativeSelect.readOnly?: boolean | undefined` (default false): A native select has no readonly attribute, so read-only mode requires a controlled value.
- `TidalNativeSelect.rootClassName?: string | undefined` (default ""): Optional root class name value accepted by this exported component.
- `TidalNativeSelect.value?: string | number | undefined`: Optional value value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/native-select.tsx) | [Manifest](https://tidalui.com/examples/native-select.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useId, useRef, useState, type FormEvent } from "react";

import { TidalNativeSelect } from "./components/ui/native-select";

import "./components/ui/native-select.css";



const tidalExampleStyles = ".tidal-scope .native-select-demo {\n  container: native-select-demo / inline-size;\n  width: min(100%, 520px);\n  min-width: 0;\n  color: var(--t-ink);\n}\n\n.tidal-scope .native-select-demo form {\n  display: grid;\n  gap: 24px;\n}\n\n.tidal-scope .native-select-demo-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 14px;\n  min-width: 0;\n  padding-top: 18px;\n  border-top: 1px solid var(--t-border);\n}\n\n.tidal-scope .native-select-demo-footer > p {\n  min-width: 0;\n  margin: 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.55;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .native-select-demo-footer > div {\n  display: flex;\n  flex: none;\n  gap: 8px;\n}\n\n.tidal-scope .native-select-demo-footer button {\n  min-height: 44px;\n  padding: 9px 14px;\n  border: 1px solid var(--t-border);\n  border-radius: var(--t-radius-control);\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 12px;\n  font-weight: 640;\n  cursor: pointer;\n  transition:\n    background-color 140ms,\n    color 140ms,\n    transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .native-select-demo-footer button[type=\"submit\"] {\n  border-color: var(--t-ink);\n  background: var(--t-ink);\n  color: var(--t-surface);\n}\n\n.tidal-scope .native-select-demo-footer button:hover {\n  border-color: var(--t-ink);\n}\n\n.tidal-scope .native-select-demo-footer button[type=\"submit\"]:hover {\n  background: var(--t-surface);\n  color: var(--t-ink);\n}\n\n.tidal-scope .native-select-demo-footer button:active {\n  transform: scale(0.98);\n}\n\n.tidal-scope .native-select-demo-footer button:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n@container native-select-demo (max-width: 420px) {\n  .tidal-scope .native-select-demo-footer {\n    align-items: stretch;\n    flex-direction: column;\n  }\n\n  .tidal-scope .native-select-demo-footer > div {\n    display: grid;\n    grid-template-columns: repeat(2, minmax(0, 1fr));\n  }\n}\n\n@container native-select-demo (max-width: 300px) {\n  .tidal-scope .native-select-demo-footer > div {\n    grid-template-columns: minmax(0, 1fr);\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .native-select-demo-footer button {\n    transition: none;\n  }\n\n  .tidal-scope .native-select-demo-footer button:active {\n    transform: none;\n  }\n}";

export function NativeSelectDemo() {
  const generatedId = useId().replace(/:/g, "");
  const selectRef = useRef<HTMLSelectElement>(null);
  const [visibility, setVisibility] = useState("team");
  const [error, setError] = useState("");
  const [status, setStatus] = useState(
    "Choose who can open this fictional workspace.",
  );

  function submitSelection(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    const node = selectRef.current;
    if (!node?.checkValidity()) {
      setError("Choose a workspace visibility.");
      node?.focus({ preventScroll: true });
      return;
    }
    setError("");
    setStatus(`Local visibility preview: ${node.selectedOptions[0]?.text}.`);
  }

  return (
    <section className="native-select-demo" aria-label="Native select preview">
      <form
        onSubmit={submitSelection}
        onReset={() => {
          setVisibility("team");
          setError("");
          setStatus("The local sample was reset.");
        }}
        noValidate
      >
        <TidalNativeSelect
          ref={selectRef}
          id={`${generatedId}-visibility`}
          label="Workspace visibility"
          name="visibility"
          value={visibility}
          onChange={(event) => {
            setVisibility(event.currentTarget.value);
            setError("");
            setStatus("The sample selection changed locally.");
          }}
          required
          description="Uses the platform select menu and prepares no request."
          error={error || undefined}
        >
          <option value="">Choose visibility</option>
          <option value="private">Only workspace owners</option>
          <option value="team">Everyone in the sample workspace</option>
          <option value="reviewers">
            Workspace members and invited project reviewers
          </option>
        </TidalNativeSelect>

        <div className="native-select-demo-footer">
          <p role="status" aria-live="polite">
            {status}
          </p>
          <div>
            <button type="reset">Reset</button>
            <button type="submit">Apply preview</button>
          </div>
        </div>
      </form>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <NativeSelectDemo />
    </div>
  );
}

```

## Gotchas

- Keep field state, validation results, submission, and persistence in the host form workflow.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Extends native single-select attributes except component-owned children, multiple/size, value/defaultValue change channels, disabled/readOnly, and their ARIA mirrors. Required label and children accept native option/optgroup content. Optional description/error ReactNode values receive linked IDs without dropping numeric zero; external aria-describedby values compose. Native value/defaultValue provide controlled or uncontrolled selection. Read-only mode is an explicit controlled-only union because HTML select has no readonly attribute; it keeps the select focusable and submitted, blocks pointer/keyboard value changes, restores its supplied value if a change is dispatched, and exposes aria-readonly. Disabled or aria-disabled=true resolves to actual native disabled behavior; explicit aria-disabled=false is preserved. Error or native aria-invalid=true/string true activates linked invalid presentation while other supplied values remain available. Native name/form/required/autoComplete handlers, option semantics, className and the forwarded select ref are preserved. The component owns no custom popup, filtering, request, storage, or selection side effect.
