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-select
  label="Select a small 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-select>

<dap-ds-select
  size="lg"
  label="Select a large 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-select>
</>
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'
Slots

No slots available.

Attributes
PropertyTypeDefaultDescription
valuestringThe value of the select.
placeholderstring nullThe placeholder of the select.
placementPopupPlacement'bottom-start'The placement of the select dropdown. Default is 'bottom-start'. Can be 'top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end'.
openedbooleanfalseWhether the select dropdown is opened.
syncboolean The sync mode of the select dropdown. How the dropdown item size is synced to the trigger element. Default is both. Can be width, height, or both.
labelstringThe label of the select.
descriptionstringThe description of the select.
tooltipstringThe tooltip of the select.
size'sm' 'lg'The size of the select. Default is sm. Can be sm or lg.
disabledbooleanWhether the select is disabled.
requiredbooleanWhether the select is required.
readonlybooleanWhether the select is readonly.
autofocusbooleanWhether the select is autofocus.
loadingboolean falseWhether the select is loading.
maxHeightnumber The max height of the floating dropdown.
feedbackstringThe feedback of the select.
feedbackType'info' 'success' 'error'The feedback type of the select. Can be info, success, or error.
isMobileboolean falseWhether the select is in mobile mode.
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
noAnimationboolean falseThe animation state of the select. Default is false
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.