Skip to content
Klarhimmel UI

Native select

npx shadcn add @klarhimmel/native-select @klarhimmel/input

Examples

  • Basic

  • Form

  • States

DetailsAbout, usage, props and more

The browser's own select in the system's field style. Best on phones and for short lists.

When to use

  • Use for

    One value from a short, fixed list, especially on phones.

  • Not for

    Long searchable lists, or options with icons.

  • Pairs with

    Field, forms and filters.

Preview

You can change this later.

native-select.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Field } from '@/components/klarhimmel/ui/input';
import { NativeSelect } from '@/components/klarhimmel/ui/native-select';

export default function Example() {
  return (
    <Theme theme="brand">
      <Field label="Room type">
        {(p) => (
          <NativeSelect {...p}>
            <option>Single</option>
            <option>Double</option>
          </NativeSelect>
        )}
      </Field>
    </Theme>
  );
}

Import

Import

import { NativeSelect } from '@/components/klarhimmel/ui/native-select';
Files
native-select.tsx, input.tsx, in components/klarhimmel/ui/. With it: button, editing, theme, utils. npm: lucide-react.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

Props

PropTypeDefaultDescription
invalidboolean-Sets aria-invalid and the danger border.
native attributesSelectHTMLAttributes-Every native attribute of the element passes through, className included.

Accessibility

KeyDoes
Space / Enter / Up / DownOpens the browser's picker
Type a letterJumps to a matching option

The browser draws the open list, so it is always accessible and always native.

Accessibility