Skip to content

SingleSelect

Tag name: <vscode-single-select>

Allows to select an item from multiple options.

When participating in a form, it supports the :invalid pseudo class. Otherwise the error styles can be applied through the invalid property.

Properties

comboboxreflects
Namecombobox
Attributecombobox
Type

boolean

Default

false

Description

Options can be filtered by typing into a text input field.

defaultValue
NamedefaultValue
Attributedefault-value
Type

string

Default

''

disabledreflects
Namedisabled
Attributedisabled
Type

boolean

Description

The element cannot be used and is not focusable.

filter
Namefilter
Attributefilter
Type

'contains' | 'fuzzy' | 'startsWith' | 'startsWithPerTerm'

Default

'fuzzy'

Description

Search method in the filtered list within the combobox mode.

  • contains - The list item includes the searched pattern at any position.
  • fuzzy - The list item contains the letters of the search pattern in the same order, but at any position.
  • startsWith - The search pattern matches the beginning of the searched text.
  • startsWithPerTerm - The search pattern matches the beginning of any word in the searched text.
focusedreflects
Namefocused
Attributefocused
Type

boolean

Default

false

Description

Its value is true when element is focused.

formreadonly
Nameform
Type

HTMLFormElement | null

invalidreflects
Nameinvalid
Attributeinvalid
Type

boolean

Default

false

Description

Sets the invalid state manually.

namereflects
Namename
Attributename
Type

string | undefined

Default

undefined

openreflects
Nameopen
Attributeopen
Type

boolean

Default

false

Description

Toggle the dropdown visibility.

options
Nameoptions
Attributeoptions
Type

Option[]

positionreflects
Nameposition
Attributeposition
Type

'above' | 'below'

Default

'below'

Description

Position of the options list when visible.

requiredreflects
Namerequired
Attributerequired
Type

boolean

Default

false

selectedIndex
NameselectedIndex
Attributeselected-index
Type

number

validationMessagereadonly
NamevalidationMessage
Type

string

validityreadonly
Namevalidity
Type

ValidityState

value
Namevalue
Attributevalue
Type

string

versionreadonly
Nameversion
Type

string

Description

VSCode Elements version

willValidatereadonly
NamewillValidate

Methods

checkValidity() : boolean
NamecheckValidity
reportValidity() : boolean
NamereportValidity

Events

change
Namechange
TypeEvent
input
Nameinput
TypeEvent
vsc-changedeprecated
Namevsc-change
TypeCustomEvent
Description

CSS Custom Properties

--dropdown-z-index
Name--dropdown-z-index
Default value2
Description

workaround for dropdown z-index issues

--vscode-badge-background
Name--vscode-badge-background
Default value#616161
--vscode-badge-foreground
Name--vscode-badge-foreground
Default value#f8f8f8
--vscode-focusBorder
Name--vscode-focusBorder
Default value#0078d4
--vscode-font-family
Name--vscode-font-family
Default valuesans-serif
--vscode-font-size
Name--vscode-font-size
Default value13px
--vscode-font-weight
Name--vscode-font-weight
Default valuenormal
--vscode-foreground
Name--vscode-foreground
Default value#cccccc
--vscode-inputValidation-errorBackground
Name--vscode-inputValidation-errorBackground
Default value#5a1d1d
--vscode-inputValidation-errorBorder
Name--vscode-inputValidation-errorBorder
Default value#be1100
--vscode-list-activeSelectionBackground
Name--vscode-list-activeSelectionBackground
Default value#04395e
--vscode-list-activeSelectionForeground
Name--vscode-list-activeSelectionForeground
Default value#ffffff
--vscode-list-focusHighlightForeground
Name--vscode-list-focusHighlightForeground
Default value#2aaaff
--vscode-list-focusOutline
Name--vscode-list-focusOutline
Default value#0078d4
--vscode-list-highlightForeground
Name--vscode-list-highlightForeground
Default value#2aaaff
--vscode-list-hoverBackground
Name--vscode-list-hoverBackground
Default value#2a2d2e
--vscode-list-hoverForeground
Name--vscode-list-hoverForeground
Default value#ffffff
--vscode-settings-checkboxBackground
Name--vscode-settings-checkboxBackground
Default value#313131
--vscode-settings-dropdownBackground
Name--vscode-settings-dropdownBackground
Default value#313131
--vscode-settings-dropdownBorder
Name--vscode-settings-dropdownBorder
Default value#3c3c3c
--vscode-settings-dropdownForeground
Name--vscode-settings-dropdownForeground
Default value#cccccc
--vscode-settings-dropdownListBorder
Name--vscode-settings-dropdownListBorder
Default value#454545