UI-select component
The UI-select component is a single select/multiple select component that enables the selection of a collection of items. It extends all abstract configuration and can be configured in two modes:
- Single - checkbox isn't displayed
- Multiple - checkboxes are displayed
Options
data-variant=success
data-slots=text
searchUrl. If you'd like to use other data for the request, you can override the processRequest method in your component.importsimports: {<br /> options: '${ $.optionsConfig.anme }:options'<br />}actionsactions: [<br /> {<br /> value: 'selectAll',<br /> label: $t('Select all')<br />},<br />{<br /> value: 'deselectAll',<br /> label: $t('Deselect all')<br />},<br />{<br /> value: 'selectPage',<br /> label: $t('Select all on this page')<br />},<br />{<br /> value: 'deselectPage',<br /> label: $t('Deselect all on this page')<br />},<br />Optional configuration
chipsEnabledcloseBtncloseBtnLabel$t('Done')deviationemptyOptionsHtmlfilterPlaceholderisDisplayMissingValuePlaceholderisRemoveSelectedIconlevelsVisibilityloadingmissingValuePlaceholder'Entity with ID: %s doesn\'t exist'options.< option name >.labeloptions.< option name >.valueoptions.< option name >.optgroupopenLevelsActionpageLimitsearchOptionssearchUrlseparatoroptgroupshowCheckboxshowOpenLevelsActionIconshowTreevalidationLoadingThe following configuration can be passed in as arguments:
- Link to any of the UI component templates
- Link to the constructor
- Label to ui-select
- Default caption
- Caption if more than one element is selected
Modes
simple mode
simple mode sets the following values to false:
showCheckboxchipsEnabledcloseBtn
optgroup mode
optgroup mode sets the following values to false:
showCheckboxopenLevelsAction
optgroup sets the following values to true:
lastSelectableoptgroupLabelslabelsDecoration
Examples
Use cms_page_listing.xml
<Magento_Cms>/view/adminhtml/ui_component/cms_page_listing.xml
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<filterSelect name="uiSelect">
<argument name="optionsProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">Magento\Cms\Model\Page\Source\PageLayout</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/element/ui-select</item>
<item name="template" xsi:type="string">ui/grid/filters/elements/ui-select</item>
<item name="dataScope" xsi:type="string">uiSelect</item>
<item name="label" xsi:type="string" translate="true">uiSelect</item>
</item>
</argument>
</filterSelect>
</listing>
Configured select component view
The following is an example of the configuration of a select component. It is used as a column filter with three levels of options, with no selectable label for every level, without checkboxes:
Navigation
The UI-select component supports keyboard navigation.
Navigation keys:
Enter: if focus is on the caption a list of options opens; if focus is on the same option it will select or deselect the current optionSpace: copies theEnterkey functionalityEscape: closes the list of optionsPageUp: sets focus to the previous optionPageDown: sets focus to the next option