Skip to content

GkSelect ​

Native <select> backed by an options array. This stays close to the platform—no menu, virtual list, or combobox (those belong in app code or a future headless primitive).

When to use ​

Use for native single or multi-select controls where platform keyboard behavior is preferred over a custom combobox UI.

Live Examples ​

Single select

Options array and placeholder inside GkField.

Multiple

Array v-model and native size for visible rows.

Readonly

Readonly select reverts changes and sets aria-readonly.

API ​

Props ​

PropTypeDefaultDescription
modelValuestring | number | (string | number)[] | undefined—Selected value; array when multiple is true
optionsGkSelectOption[]requiredOptions list
idstring—Overrides injected field id
namestring—Form name
disabledbooleanfalseDisabled
readonlybooleanfalseReverts change and sets aria-readonly (native readonly is not reliable on <select>)
multiplebooleanfalseNative multiple; use an array modelValue
requiredboolean—Native required
sizeGkFormControlSize | number—String ('xs' … 'xl'): visual control scale. Number: native <select size="n"> (visible rows, often with multiple); visual size then comes from defaults / GK_FORM_CONTROLS.
placeholderstring—First disabled option (value="")
autocompletestring—Native autocomplete
ariaLabelstring—When not inside GkField

Root class applies to the wrapper; other attributes are forwarded to <select>.

GkSelectOption: { value: string | number; label: string; disabled?: boolean }

Events ​

EventPayloadDescription
update:modelValuestring | number | (string | number)[] | undefinedNew selection
update:focusedbooleantrue on focus, false on blur

Expose ​

NameTypeDescription
selectHTMLSelectElementNative <select>

Examples ​

Each scenario under Live Examples includes a copyable Vue snippet.

Accessibility notes ​

  • Wrap with GkField for visible labels and error semantics in forms.
  • Provide ariaLabel when used standalone.
  • For multiple, pass a numeric size (native visible rows) when you need a listbox. For a single closed dropdown, use a string size (or global default) for typography and hit area only.

Released under the MIT License.