A web component library for both internal and external development, built with Lit and Shoelace.
Dropdown component for selecting from a list of items. This element supports filtering and can be navigated using keyboard shortcuts.
Slot | Usage |
---|---|
slot="label" |
|
slot="prefix" |
|
slot="suffix" |
|
slot="help-text" |
|
Name | Description | Type |
---|---|---|
stayOpenOnSelect stay-open-on-select |
Keeps the dropdown open when an item is selected from the list | Boolean |
autoFilter auto-filter |
Filters down the listed elements based on what the user types in the search section | Boolean |
lookLikePaperElement look-like-paper-element |
Formats the dropdown to look like the Polymer paper-dropdown-menu |
Boolean |
open |
Indicates if the dropdown section is opened (can be included in the element to start with it open) | Boolean |
hoist |
Allows the dropdown part of the element to go outside of the containing element | Boolean |
filled |
Fills the background with a grey color. The color is stored in var(--sl-input-filled-background-color) and can be changed by overwriting this css variable. |
Boolean |
pill |
Creates rounded corners for the dropdown | Boolean |
clearable |
Includes an icon button that clears user input from the search | Boolean |
disabled |
Greys out the dropdown and stops users from interacting with it | Boolean |
placement |
|
String |
autocomplete |
|
String |
size |
|
String |
label |
The plain text value to place above the input, to descibe the dropdown | String |
helpText |
The plain text placed under the input, to help users further understand the dropdown content | String |
placeholder |
The plain text that appears in the input section when nothing has been typed yet | String |
value |
Indicates the currently selected item in the list. Note: The value and label attributes aren't necessarily the same unless you make them the same. An item's label represents what is displayed in the dropdown, while it's value indicates what it represents. | String |
items |
|
Array |
containingElement |
The element that determines where a dropdown can appear. The formatting follows the normal DOM by default. This property is used for edge cases or for clipping a dropdown that doesn't use hoist |
Object |
renderItem |
|
Function |
import '@katapult-engineering/elements/katapult-searchable-dropdown.js';