Select

Select component that allows users to select a single option from a list of options.

Design system docs

Examples Default select field
<dap-ds-select
label="Select a fruit">
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item>
<dap-ds-option-item value="item2">Peach</dap-ds-option-item>
<dap-ds-option-item value="item3" disabled>Cherry</dap-ds-option-item>
<dap-ds-option-item value="item4">
  <dap-ds-icon-home-6-line slot="prefix"></dap-ds-icon-home-6-line>
  Strawberry
</dap-ds-option-item>
</dap-ds-select>
Sizes

Select component comes in three sizes: small, large. The default size is small.

<dap-ds-stack>
<dap-ds-select
size="xs"
label="Select an extra small fruit"
description="This is an extra small select field"
feedback="This is a feedback message"
feedbacktype="negative"
>
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item>
</dap-ds-select>

<dap-ds-select
label="Select a small fruit"
description="This is a small select field"
feedback="This is a feedback message"
feedbacktype="negative"
>
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item>
</dap-ds-select>

<dap-ds-select
size="lg"
label="Select a large fruit"
description="This is an large select field"
feedback="This is a feedback message"
feedbacktype="negative"
>
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item></dap-ds-select>
</dap-ds-stack>
Statuses

The select component can have a status of error, success, disabled, loading.

<>
<dap-ds-select
status="error"
label="Wrong fruits">
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item>
</dap-ds-select>

<dap-ds-select
status="success"
label="Good fruits">
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item>
</dap-ds-select>

<dap-ds-select
disabled
label="Do not select fruits">
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item>
</dap-ds-select>

<dap-ds-select
loading
label="Fruits are loading">
<dap-ds-option-item value="item0">
  Apple
</dap-ds-option-item>
<dap-ds-option-item value="item1">Pear</dap-ds-option-item>
</dap-ds-select>
</>
Importing
import { DapDSSelect } from 'dap-design-system/dist/dds'
Importing React
import { DapDSSelectReact } from 'dap-design-system/dist/react'
Attributes
PropertyTypeDefaultDescription
placement'top', 'top-start' , 'top-end' , 'right' , 'right-start', 'right-end' , 'bottom' , 'bottom-start' , 'bottom-end' , 'left' , 'left-start' , 'left-end''bottom-start'The popup placement of the select
openedbooleanfalseWhether the select dropdown is opened.
placeholderstring, nullThe placeholder of the select.
syncboolean, undefinedThe sync size of the select dropdown
isMobileboolean, undefinedfalseWhether the select is in mobile mode.
loadingboolean, undefinedfalseThe loading state of the select.
maxHeightnumber, undefinedThe max heigth of the select dropdown.
noAnimationboolean, undefinedfalseWhether the select dropdown indicator is animated or not
floatingStrategy'absolute', 'fixed''absolute'The floating strategy of the select dropdown
valuestringThe value of the select.
labelstringThe label of the select.
descriptionstringThe description of the select.
tooltipstringThe tooltip of the select.
tooltipPlacement'top', 'right' , 'bottom' , 'left'The tooltip placement of the select.
size'xs', 'sm' , 'lg'The size of the select. Default is sm.
disabledbooleanWhether the select is disabled.
requiredbooleanWhether the select is required.
readonlybooleanWhether the select is readonly.
autofocusbooleanWhether the select is autofocus.
feedbackstringThe feedback of the select.
feedbackTypenegative, positive , warningThe feedback type of the select. Can be negative, positive, or warning.
statusstringThe status of the select. Can be success or error.
optionalbooleanThe optional state of the select.
optionalLabelstringThe optional label of the select.
subtlebooleanThe weight of the label. Default is false
Slots
NameDescription
(default)The option list of the select.
indicator-iconThe indicator icon of the select.
Events
Event NameDescription
dds-changeFired when the select value changes.
dds-blurEmitted when the select loses focus.
dds-focusEmitted when the select gains focus.
CSS Parts
Part NameDescription
baseThe main select container.
triggerThe trigger button of the select.
labelThe label of the select.
descriptionThe description of the select.
feedbackThe feedback of the select.
tooltipThe tooltip of the select.
option-listThe option list of the select.