Component
Native select
<DomNativeSelect>A styled native select for cases where browser-native picker behaviour is intentionally preferred.
Playground
Try every prop live
Native select playground
Use this only when browser-native select behaviour is specifically valuable. Prefer DomSelect for rich app option rendering.
Choose where this should be saved.
<script setup>
import { reactive } from 'vue';
import { DomNativeSelect } from '@getdom/studio/vue';
const data = reactive({
"modelValue": "design",
"id": "",
"name": "",
"label": "Workspace",
"description": "Choose where this should be saved.",
"placeholder": "Select an option",
"required": false,
"disabled": false,
"readOnly": false,
"invalid": false,
"errors": [],
"visible": true,
"validators": [],
"validateOnBlur": true,
"chrome": "field",
"options": [
{
"label": "Design system",
"value": "design"
},
{
"label": "Marketing site",
"value": "marketing"
},
{
"label": "Internal tools",
"value": "tools"
}
]
});
</script>
<template>
<DomNativeSelect
v-bind="data"
@update:modelValue="data.modelValue = $event"
/>
</template>Demo
Styled native control
This is still a real select element, so mobile platforms get their native picker UI.
Native select behaviour, styled with DOM Studio tokens.
<script setup>
import { ref } from 'vue';
import { DomNativeSelect } from '../../../lib/vue';
const workspace = ref('design');
const workspaces = [
{ label: 'Design system', value: 'design' },
{ label: 'Marketing site', value: 'marketing' },
{ label: 'Internal tools', value: 'tools' },
];
</script>
<template>
<div class="w-full max-w-sm">
<DomNativeSelect
v-model="workspace"
label="Workspace"
description="Native select behaviour, styled with DOM Studio tokens."
:options="workspaces"
/>
</div>
</template>
Guidance
Prefer rich app selects
Most application UIs should use DomSelect, DomListbox, or DomCombobox so options can show descriptions, status, avatars, counts, and metadata. Use native select for platform picker behaviour, extreme compatibility needs, or very plain settings.
Reference
Props
Control props
| Name | Type | TS | Default | Description |
|---|---|---|---|---|
placeholder | string | string | 'Select an option' | Disabled placeholder option. |
optionsts | array | Array< | [] | Options can be strings or objects with label/value. |
Field props
| Name | Type | TS | Default | Description |
|---|---|---|---|---|
modelValue | any | any | '' | Current field value. |
id | string | string | '' | Optional ID override. By default parent forms derive the input ID from the field path using underscores. |
name | string | string | '' | Local field name. Parent forms derive the full field path and native HTML name from the form hierarchy. |
label | string | string | '' | Visible field label. |
description | string | string | '' | Optional helper copy below the field. |
required | boolean | boolean | false | Mark the field as required. |
disabled | boolean | boolean | false | Disable field interaction. |
readOnly | boolean | boolean | false | Show the value but prevent editing. |
invalid | boolean | boolean | false | Mark the field invalid. |
errorsts | array | object | string | Array< | [] | Validation errors for this field. |
visible | boolean | boolean | true | Show or hide the field. |
validators | array | Array<unknown> | [] | Validators attached to this field. Use functions in Vue code, or serializable records such as { name: "minLength", props: { min: 2 } } in generated schemas. |
validateOnBlur | boolean | boolean | true | Run validators when the field loses focus. |
chrome | 'field' | 'none' | false | string | 'field' | Render default field chrome, or hide chrome while keeping form state wiring. |
Auto-generated from Native select.props and inline _edit hints.
Events
| Name | Payload | Description |
|---|---|---|
| @update:modelValue | string | Fired when the selected option changes. |
Names auto-detected from defineEmits and source emit() calls; payload and description from __doc.events when present.