Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Forms & Input

Native Select

Browser-native `<select>` with Kamod styling, chevron affordance, sizes, validation states, and RTL-friendly layout — aligned with Starwind UI patterns. Make the expected input clear before someone interacts, and keep the current value, help text and validation feedback connected. Import it from @/components/kamod-ui/native-select.

Source · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import NativeSelect, NativeSelectOption, and optionally NativeSelectOptGroup from @/components/kamod-ui/native-select.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

Use NativeSelect for forms that should use the platform picker on mobile. Pair with Label and aria-invalid for accessible validation. Prefer the custom Select when you need search, portals, or rich option content.

Import SetupTypeScript
import { NativeSelect } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Native Select in Different Contexts, from the starting pattern to the compositions below. Begin with Default, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Default

Keep the Browser-Native Interaction Predictable. Pair NativeSelect with a Label and matching identifiers, then use an empty first option with required when a choice is mandatory. The native browser control supplies the picker while the field explains its purpose.

Use stable option values and a deliberate empty state, and ensure application validation agrees with the native required behavior rather than relying on placeholder styling alone.

src/components/NativeSelectExample.tsx14 lines
import { Label, NativeSelect, NativeSelectOption } from "@kamod-ch/ui";

export const Example = () => (
  <div class="flex w-full min-w-0 max-w-[240px] flex-col gap-2">
    <Label for="native-select-fruit">Fruit</Label>
    <NativeSelect id="native-select-fruit" class="w-full" required defaultValue="">
      <NativeSelectOption value="">Select a fruit</NativeSelectOption>
      <NativeSelectOption value="apple">Apple</NativeSelectOption>
      <NativeSelectOption value="banana">Banana</NativeSelectOption>
      <NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
      <NativeSelectOption value="pineapple">Pineapple</NativeSelectOption>
    </NativeSelect>
  </div>
);

Groups

Categorize Options without Changing Selection Semantics. Use NativeSelectOptGroup to organize related options under shared labels within the browser's own picker. This helps distinguish categories without replacing native selection behavior with a custom popup implementation.

Keep category names brief, avoid many tiny groups, and test the actual platform picker because native presentation varies by device.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Disabled

Distinguish an Unavailable Field from an Unavailable Choice. Disable the entire native select when the choice is unavailable, or disable individual options that cannot currently be selected. Preserve meaningful labels so the remaining options and current value still make sense in context.

Explain prerequisites outside the picker and check the current value when options become unavailable after a related field changes.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Invalid

Pair Invalid State with a Correction. Set aria-invalid on the select and show a nearby explanation when validation rejects the current choice. The browser-native interaction stays familiar while the application's message describes what the user needs to correct.

Keep the label visible and update feedback after correction; a colored border alone is not enough to describe the problem.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Size

Match the Select to Nearby Fields. Use the component's size option to coordinate the select's visual height with adjacent fields and actions. Compare compact and larger treatments with realistic option labels before choosing a density for the form.

Check long option names and touch interaction, remembering that the browser controls the opened picker even when the closed field uses your theme's dimensions.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Native Select vs Select

Choose the Least Complex Control that Fits the Task. Choose Select or Combobox when custom popup structure or search is needed. NativeSelect is a simpler starting point when platform-native option selection adequately expresses the task.

Try the native version with the keyboard and on a phone before adding more layers. Preserve its label, default value and form submission behavior if you later migrate to a custom control; appearance alone is not a reason to duplicate working field state.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Native Select using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/native-select3.5 KB min · 1.3 KB gzipSignals: none

NativeSelect

NativeSelectProps

NativeSelect documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildNativeSelectProps

Configure children for NativeSelect. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>NativeSelectProps

Configure class for NativeSelect. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
icon
ComponentChild[] | ComponentChildNativeSelectProps

Configure icon for NativeSelect. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
size
"sm" | "md" | "lg"NativeSelectProps

Configure size for NativeSelect. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"md"

NativeSelectOptGroup

NativeSelectOptGroupProps

NativeSelectOptGroup documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildNativeSelectOptGroupProps

Configure children for NativeSelectOptGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

NativeSelectOption

NativeSelectOptionProps

NativeSelectOption documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildNativeSelectOptionProps

Configure children for NativeSelectOption. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

NativeSelect Props

2 declared fields
NativeSelectProps
Exported Source Declaration from NativeSelect.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of NativeSelectProps before adapting it.

NativeSelectOptGroup Props

1 declared field
NativeSelectOptGroupProps
Exported Source Declaration from NativeSelectOptGroup.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of NativeSelectOptGroupProps before adapting it.

NativeSelectOption Props

1 declared field
NativeSelectOptionProps
Exported Source Declaration from NativeSelectOption.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of NativeSelectOptionProps before adapting it.

Accessibility

Build the Complete Interaction, Including the Parts Outside Native Select. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.

Built-in Behavior and Defaults

NativeSelect keeps the browser's native select interaction, platform picker and form behavior. Its chevron is decorative. The wrapper styles do not change how labels, required values or disabled options are interpreted by the browser.

Labels and Relationships

Connect a visible label to the select's ID and write understandable option text. If selection is required, use required and an empty-value prompt option. Describe the expected choice and any unavailable options before the user opens the picker.

Keyboard and Focus

Keep the native keyboard and touch picker available. Group related options with native optgroup where useful. Selection should update the intended field rather than unexpectedly submitting the whole form or navigating away.

States and Integration Details

A disabled prompt option prevents returning to the empty state; use that only when intentional. An empty-value option is not automatically an error until your validation rules require a selection. Pair invalid styling with a linked explanation.

Verify the Complete Interaction

Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.

  1. Open with the keyboard and with a mobile picker; confirm labels and selected text remain clear.
  2. Submit the initial empty choice, choose a valid value and then reset the form.
  3. Check long options and localized labels without relying on the collapsed control's width alone.

Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.

For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.