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 preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthInstallation
Import NativeSelect, NativeSelectOption, and optionally NativeSelectOptGroup from @/components/kamod-ui/native-select.
pnpm add @kamod-ch/uiCopy 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 { 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.
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 preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthDisabled
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 preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthInvalid
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 preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthSize
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 preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthNative 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 preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthProps 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.
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
? 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.NativeSelect
NativeSelectProps
| Prop / type | Description |
|---|---|
children | Configure
|
class | Configure
|
icon | Configure
|
size | Configure
|
NativeSelectOptGroup
NativeSelectOptGroupProps
| Prop / type | Description |
|---|---|
children | Configure
|
NativeSelectOption
NativeSelectOptionProps
| Prop / type | Description |
|---|---|
children | Configure
|
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 fieldsNativeSelectPropsNativeSelect.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 fieldNativeSelectOptGroupPropsNativeSelectOptGroup.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 fieldNativeSelectOptionPropsNativeSelectOption.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.
- Open with the keyboard and with a mobile picker; confirm labels and selected text remain clear.
- Submit the initial empty choice, choose a valid value and then reset the form.
- 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.
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.