0.1.9 • Published 9 months ago

@phase2/outline-dropdown v0.1.9

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
9 months ago

outline-dropdown

Properties

PropertyAttributeTypeDefaultDescription
containingElementHTMLElement \| undefinedThe dropdown will close when the user interacts outside of this element (e.g. clicking).
hasDropdownboolean
hasFooterboolean
hasHeaderboolean
isDisabledis-disabledbooleanfalseDisables the dropdown so the panel will not open.
isLinkbooleanfalseDetermines if the dropdown trigger is a link or not.
isOpenis-openbooleanfalseIndicates whether or not the dropdown is open.You can use this in lieu of the show/hide methods.
panelHTMLElement
slotsSlotController"new SlotController(this, true)"
triggerHTMLElement
triggerLabeltrigger-labelstringARIA label attribute to pass down to the resulting button or aelement. This is required for accessibility if we use a buttonwith an icon only.
triggerTargettrigger-targetLinkTargetTypeThe target to use for a link, used in conjunction with the url attribute.
triggerTexttrigger-textstringVisible text for the button/link of the trigger element.
triggerUrltrigger-urlstringThe url to use for a link. This will render an anchor element.Do not set this prop if you want to render a button element.
triggerVarianttrigger-variantButtonVariant"link"The button style variant to use.

Methods

MethodTypeDescription
buttonTemplate(): TemplateResult<ResultType> \| nullTemplate partial for the "button" rendering.
dropdownTemplate(): TemplateResult<ResultType> \| nullTemplate partial for the dropdown rendering.
focusOnTrigger(): void
footerTemplate(): TemplateResult<ResultType> \| nullTemplate partial for the footer rendering.
handleButtonTrigger(event: KeyboardEvent): void
handleDocumentMouseDown(event: MouseEvent): void
handleEnterKeyDown(event: KeyboardEvent, isIcon?: boolean): void
handleEscKeyDown(event: KeyboardEvent): void
handleFocusChange(): void
handleHoverStyles(): void
handleIconClick(event: MouseEvent): void
handleIconTrigger(event: KeyboardEvent): void
handleOpenChange(): Promise<void>
handlePanelKeystrokes(event: KeyboardEvent): void
headerTemplate(): TemplateResult<ResultType> \| nullTemplate partial for the header rendering.
hide(): Promise<void>Hides the dropdown panel.
iconTemplate(): TemplateResult<ResultType> \| nullTemplate partial for the icon rendering.
iconWrapperTemplate(): TemplateResult<ResultType> \| nullTemplate partial for the icon rendering.
show(): Promise<void>Shows the dropdown panel.

Events

EventDescription
outline-after-hideEmitted after the dropdown closes and all animations are complete.
outline-after-showEmitted after the dropdown opens and all animations are complete.
outline-hideEmitted when the dropdown closes.
outline-showEmitted when the dropdown opens.

Slots

NameDescription
dropdownContent to be rendered in the dropdown.
footerContent to be rendered in the footer of the dropdown.
headerContent to be rendered in the header of the dropdown.

CSS Shadow Parts

PartDescription
baseThe component's base wrapper.
panelThe panel that gets shown when the dropdown is open.
triggerThe container that wraps the trigger.