Dropdown Showcase

Example

Example is_multiselect

passed in label:

null

Example horiz_selector

Width

null

Component Documentation

Component Name

Dropdown

Builder Function Name

create_dropdown_manager

Description

provides a dropdown or horizontal selector interface to select from an array of options, with optional search support and multi-selection

Use like example

Config

PropertyTypeDefaultDescription
valany

the current selection; can be a single value or array for multiselect

optionsarray

the array of selectable items; each item can be a simple value or an object

on_changefunction

callback invoked on each selection, receiving the new val

on_item_clickfunction

callback invoked whenever an item is clicked, receiving the item object

on_dropdown_openedfunction

callback triggered when the dropdown popover is opened

on_dropdown_closedfunction

callback triggered when the dropdown popover is closed

on_searchfunction

optional async callback for searching items, called with { input, id } and returning { options }

labelstring

label text displayed above or near the dropdown

typestring

dropdown

mode: 'dropdown' or 'horiz_selector'

is_collapsedboolean

false

if true, operates in 'collapsed' mode for toggling

val_keystring

key

key in each option object used to identify the value

row_display_keysarray

name

array of keys from which to build a display string for each row

button_display_keysarray

name

array of keys used to show text in the dropdown button

is_multiselectboolean

false

if true, multiple values can be selected

is_set_null_buttonboolean

false

if true, provides a button to clear the selection

is_disabledboolean

false

disables the entire control if true

headerstring

header text for horizontal selector

header_iconstring

icon id displayed next to header if using horiz_selector

header_icon_degnumber

0

icon rotation in degrees for the header icon

min_header_widthnumber

2

minimum width (rem) reserved for the header text in horiz_selector

spacer_colorstring

var(--shadow2-t)

color for the vertical spacer in horiz_selector

error_messagestring

error text displayed under the label

placeholderstring

Select

placeholder text if no selection is made

target_widthnumber

250

popover width in px

target_heightnumber

200

popover height in px

font_weightnumber

500

font weight for displayed items

font_sizenumber

1.2

font size (rem) for displayed items

is_show_xboolean

false

if true, an x to close the popover is shown

text_alignstring

left

text alignment for items (left, center, right)

justify_contentstring

space-between

justification for label+arrow in the default button

is_show_arrowboolean

true

if true, an arrow toggle is shown in the button

button_typestring

outlined

style type for the toggle button (primary, outlined, etc.)

selected_font_sizenumber

optional alternate font size used specifically for the selection in the toggle button

is_button_compressedboolean

false

makes the dropdown button narrower if true

is_searchableboolean

false

if true, shows a text input for filtering or triggering an on_search callback

is_hide_buttonboolean

false

if true, hides the main toggle button for a fully open experience

anchor_idstring

specifies the element id to anchor the popover, or defaults to the toggle button

mlnumber

0

margin-left in rem for the button

mrnumber

0

margin-right in rem for the button

mtnumber

0

margin-top in rem for the button

mbnumber

0

margin-bottom in rem for the button

item_mbnumber

0

margin-bottom in rem for each dropdown item

Methods

MethodDescriptionParametersReturns
init

sets up popover, toggle button, filtering, search input, etc.

config: object

void
item_clicked

handles item click logic (single or multi-select), calls on_change and on_item_click if provided

item: object

void
set_val

manually sets the current selection val

input: any

void
set_options

replaces the current options array; triggers filtered button update

input: array

void

Returned Properties

PropertyTypeDescription
idstring

unique identifier for this dropdown instance

typestring

mode: 'dropdown' or 'horiz_selector'

is_collapsedboolean

if true, collapses the dropdown panel

valany

current single or multi-selection

val_keystring

property in options used as the unique key

row_display_keysarray

properties used to build displayed text for items

button_display_keysarray

properties shown in the toggle button

optionsarray

the array of items displayed in the dropdown

is_multiselectboolean

if true, multiple items can be selected simultaneously

is_set_null_buttonboolean

if true, includes a 'set to null' button in the dropdown

is_disabledboolean

disables the control if true

headerstring

header label when in horiz_selector mode

header_iconstring

icon id displayed next to the header

header_icon_degnumber

rotation in degrees for the header icon

min_header_widthnumber

minimum width in rem for the header region

spacer_colorstring

color for a vertical spacer in horiz_selector

labelstring

label text displayed above the dropdown

error_messagestring

error message displayed

placeholderstring

placeholder text if no item is selected

target_widthnumber

popover width in px

target_heightnumber

popover height in px

font_weightnumber

font weight of the displayed items

font_sizenumber

font size (rem) of the displayed items

is_show_xboolean

if true, displays an 'x' to close the popover

text_alignstring

alignment for the item text (left, center, right)

justify_contentstring

how the label and arrow are spaced in the toggle button

is_show_arrowboolean

shows an arrow indicator if true

button_typestring

the style type for the toggle button, e.g. 'outlined'

selected_font_sizenumber

alternate font size used specifically for the selected value

is_button_compressedboolean

makes the toggle button narrower if true

is_searchableboolean

if true, shows a search text input for filtering options

is_hide_buttonboolean

if true, hides the main toggle button

item_mbnumber

margin-bottom (rem) for each item in the dropdown

mlnumber

margin-left (rem) for the main button

mrnumber

margin-right (rem) for the main button

mbnumber

margin-bottom (rem) for the main button

mtnumber

margin-top (rem) for the main button

search_text_input_managerobject

text input manager used for searching options if is_searchable is true

filtered_button_managersarray

the array of dynamically generated button managers for each filtered option

popover_managerobject

popover manager controlling the dropdown's popover

toggle_button_managerobject

button manager for toggling the popover

toggle_button_textstring

the derived text displayed on the toggle button

clear_button_managerobject

button manager for clearing the selection (if is_set_null_button is true)

header_icon_managerobject

icon manager for the header icon if in horiz_selector mode

search_requests_is_loadingarray

tracks loading states of async search calls

icon
Sponsored byContibase