NativeSelect
NativeSelect styles the browser <select>, so mobile users get the system picker. Use it for dense forms and long, plain lists. For a styled dropdown use Select, and for search use Combobox.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
Sizes
Use the sm size for dense forms.
With opt groups
Group options under labels with NativeSelectOptGroup.
Invalid
Set aria-invalid to show the error border and focus ring.
Disabled
Disable the select to dim it and its chevron and block changes.
Props
NativeSelect
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | null | "default" | No description |
variant | "borderless" | "bordered" | null | "bordered" | No description |
NativeSelectOptGroup
NativeSelectOptGroup adds no props of its own; it accepts the props of the element or primitive it wraps.
NativeSelectOption
NativeSelectOption adds no props of its own; it accepts the props of the element or primitive it wraps.
NativeSelect styles the browser <select>, so mobile users get the system picker. Use it for dense forms and long, plain lists. For a styled dropdown use Select, and for search use Combobox.
Installation
Install the following dependencies:
Copy and paste the following code into your project.
components/native-select/NativeSelect.vue components/native-select/NativeSelectOptGroup.vue components/native-select/NativeSelectOption.vue components/native-select/index.ts lib/icons.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
Sizes
Use the sm size for dense forms.
With opt groups
Group options under labels with NativeSelectOptGroup.
Invalid
Set aria-invalid to show the error border and focus ring.
Disabled
Disable the select to dim it and its chevron and block changes.
Props
NativeSelect
| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | string | No default documented | The starting value when |
modelValue | string | No default documented | The selected value, for |
size | "default" | "sm" | null | "default" | No description |
variant | "bordered" | "borderless" | null | "bordered" | No description |
NativeSelectOptGroup
NativeSelectOptGroup adds no props of its own; it accepts the props of the element or primitive it wraps.
NativeSelectOption
NativeSelectOption adds no props of its own; it accepts the props of the element or primitive it wraps.