Skip to main content

Select

<sc-select></sc-select>

This component let users create select container.

Component Codex

Properties

PropertyDescriptionTypeDefault
autocompleteThe input's autocomplete attribute.string
choicesThe input's value attribute.ChoiceItem[][]
closeOnSelectbooleantrue
disabledboolean
helpSome help text for the input.string
hoistbooleanfalse
invalidThis will be true when the control is in an invalid state. Validity is determined by props such as `type`, `required`, `minlength`, `maxlength`, and `pattern` using the browser's constraint validation API.booleanfalse
labelThe input's label.string
loadingboolean
nameThe input's name attribute.string
openIs this openboolean
placeholderPlaceholder for no valuestring''
placementThe placement of the dropdown."bottom" | "bottom-end" | "bottom-start" | "left" | "left-end" | "left-start" | "right" | "right-end" | "right-start" | "top" | "top-end" | "top-start"'bottom-start'
position"bottom-left" | "bottom-right" | "top-left" | "top-right"'bottom-right'
requiredboolean
searchIs search enabled?boolean
searchPlaceholderPlaceholder for searchstring''
showParentLabelbooleantrue
sizeThe input's size."large" | "medium" | "small"'medium'
squaredboolean
squaredBottomboolean
squaredLeftboolean
squaredRightboolean
squaredTopboolean
unselectCan we unselect items.booleantrue
valueThe input's value attribute.string''

Events

EventDescriptionType
scBlurEmitted when the control loses focus.CustomEvent<void>
scChangeEmitted when the control's value changes.CustomEvent<ChoiceItem>
scCloseEmitted whent the components search query changesCustomEvent<string>
scFocusEmitted when the control gains focus.CustomEvent<void>
scOpenEmitted whent the components search query changesCustomEvent<string>
scScrollEndEmitted when the list scrolls to the end.CustomEvent<void>
scSearchEmitted whent the components search query changesCustomEvent<string>

Methods

reportValidity() => Promise<boolean>

setCustomValidity(message: string) => Promise<void>

Sets a custom validation message. If `message` is not empty, the field will be considered invalid.

Shadow Parts

PartDescription
baseThe elements base wrapper.
caretThe caret.
emptyThe empty message.
form-controlThe form control wrapper.
help-textHelp text that describes how to use the input.
inputThe html input element.
labelThe input label.
menu__baseThe menu base.
panelThem panel for the dropdown.
search
search___baseThe search base wrapper.
search__form-controlThe search form control wrapper.
search__inputThe search input element.
spinner__baseThe spinner base.
triggerThe trigger for the dropdown.