Skip to main content

Dropdown

<sc-dropdown></sc-dropdown>

Dropdown is a component that opens a floating content panel when a trigger element is clicked. This components takes care of updating the state of the dropdown menu (opened/closed) as well as handles closing the menu when clicking outside.

Click HereOption 1Option 2Option 3CheckedDisabled👍🏻PrefixSuffix 👍🏻

Examples

Position

EditCutCopyPasteFindReplace

Component Codex

Properties

PropertyDescriptionTypeDefault
clickElHTMLElement
closeOnSelectDetermines whether the dropdown should hide when a menu item is selectedbooleantrue
disabledIs this disabled.boolean
distanceThe distance in pixels from which to offset the panel away from its trigger.number10
hoistEnable this option to prevent the panel from being clipped when the component is placed inside a container with `overflow: auto|scroll`.booleanfalse
openIndicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods.booleanfalse
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'
positionThe placement of the dropdown panel"bottom-left" | "bottom-right" | "top-left" | "top-right"
skiddingThe distance in pixels from which to offset the panel along its trigger.number0

Events

EventDescriptionType
scHideEmitted when the dropdown closes. Calling `event.preventDefault()` will prevent it from being closed.CustomEvent<void>
scShowEmitted when the dropdown opens. Calling `event.preventDefault()` will prevent it from being opened.CustomEvent<void>

Shadow Parts

PartDescription
baseThe elements base wrapper.
panelThe panel.
triggerThe trigger.