ui/dropdown/utils
@ckeditor/ckeditor5-ui/src/dropdown/utils
Filtering
Type Definitions
-
A definition of the list item used by the
addListToDropdown
utility.
Functions
-
addListToDropdown( dropdownView, items )
Adds an instance of
ListView
to a dropdown.The
items
collection passed to this methods controls the presence and attributes of respective list items.See
createDropdown
andList
.Parameters
dropdownView : DropdownView
A dropdown instance to which
ListVIew
will be added.items : Iterable.<ListDropdownItemDefinition>
A collection of the list item definitions to populate the list.
-
addToolbarToDropdown( dropdownView, buttons )
Adds an instance of
ToolbarView
to a dropdown.See
createDropdown
andToolbarView
.Parameters
dropdownView : DropdownView
A dropdown instance to which
ToolbarView
will be added.buttons : Iterable.<ButtonView>
-
createDropdown( locale, ButtonClass ) → DropdownView
A helper for creating dropdowns. It creates an instance of a dropdown, with a button, panel and all standard dropdown's behaviors.
Creating dropdowns
By default, the default
DropdownButtonView
class is used as definition of the button:You can also provide other button views (they need to implement the
DropdownButton
interface). For instance, you can useSplitButtonView
to create a dropdown with a split button.Adding content to the dropdown's panel
The content of the panel can be inserted directly into the
dropdown.panelView.element
:However, most of the time you will want to add there either a list of options or a list of buttons (i.e. a toolbar). To simplify the task, you can use, respectively,
addListToDropdown
oraddToolbarToDropdown
utils.Parameters
locale : Locale
The locale instance.
ButtonClass : function
The dropdown button view class. Needs to implement the
DropdownButton
interface.
Returns
DropdownView
The dropdown view instance.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.