Skip to main content

dropDown()

dropDown(label, items, options?): DropDown

Creates a dropdown component. The most common use case is a menu dropdown.

Parameters

ParameterType
labelstring | Element
itemsDropDownMenuItems
options?DropDownOptions

Returns

DropDown

Examples

Menu dropdown (recommended):
ui.dropDown('Actions', {
'Add': () => grok.shell.info('add'),
'Edit': () => grok.shell.info('edit'),
'More': {
'Option 1': () => {},
'Option 2': () => {},
}
});
List dropdown:
ui.dropDown('Items', ['Item 1', 'Item 2', 'Item 3'], {
onItemClick: (item) => grok.shell.info(item)
});
Custom content dropdown:
ui.dropDown('Custom', () => ui.div('Any content here'));

Example: {@link https://public.datagrok.ai/js/samples/ui/components/drop-down}

Source

ui.ts:2220

dropDown(label, builder, options?): DropDown

Parameters

ParameterType
labelstring | Element
builderDropDownMenuBuilder
options?DropDownOptions

Returns

DropDown

Source

ui.ts:2221

dropDown(label, items, listOptions?, options?): DropDown

Parameters

ParameterType
labelstring | Element
itemsstring[]
listOptions?DropDownListOptions
options?DropDownOptions

Returns

DropDown

Source

ui.ts:2222

dropDown(label, createElement, options?): DropDown

Parameters

ParameterType
labelstring | Element
createElement() => HTMLElement
options?DropDownOptions

Returns

DropDown

Source

ui.ts:2223