Form | SelectField
SelectField#
Description#
- Styled dropdown that replaces the native
<select>with a custom panel, supports options as a prop or<option>in the slot, and handles a generic model (stringornumber) viav-model.
Props#
label(string) — Visible label associated with the control.id(string) — Control identifier. If not provided, one is generated automatically.disabled(boolean) — Disables the control.options(Array<SelectOption<T> | (T & string)>) — List of options as objects{ label, value, disabled? }or strings. When provided, the slot is ignored.
Emits#
change(Event) — Emitted when the user selects an option different from the current one.
Usage#
| |
Notes#
- If
optionsis not provided,<option>elements written in the slot are used (without avalueattribute, the value is the text). - The model is generic:
T extends string | number, so aref<number>withv-model.numberworks without casting. - With
labeldeclared, the component renders the label and associates it with the control viafor/id. Without it, wrapping it in a<label>also works.