OptionGroup
Examples
See Select
examples or Dropdown
examples.
API
Props
Name | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
label | string | - | The title of the option group. | ||||||||||||
expanded | boolean | false | Whether the option list is expanded. | ||||||||||||
trigger | 'click' | 'hover' | 'click' | When to expand the option list. | ||||||||||||
options | Array<Object> | [] | The option list, with each item having the structure
| ||||||||||||
position | string | inline | The way the internal options are displayed.
| ||||||||||||
overlay-class | string | Array | Object | - | Refers to the overlay-class prop of the Overlay component. | ||||||||||||
overlay-style | string | Array | Object | - | Refers to the overlay-style prop of the Overlay component. |
Slots
Name | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
default | The content of the option list. When the options prop is not specified, it can be used to directly inline Option or other OptionGroup components. | |||||||||||||||
label | The text area of the option group title. Default content: The text corresponding to the
| |||||||||||||||
group-label | The text area of the title of the sub-option group. Default content: The value of the
In addition, other properties in the current option group data will also be automatically bound to slot props through | |||||||||||||||
option-label | The text area of the option. Default content: The
In addition, other properties in the current option data will also be automatically bound to slot props through | |||||||||||||||
option | The entire area of the selectable option. Default content: The default structure of the component inside
In addition, other properties in the current option data will also be automatically bound to slot props through | |||||||||||||||
before | The pre-area of the option list. | |||||||||||||||
after | The post-area of the option list. |
### Events
| Name | Description |
| -- | -- |
| ``toggle`` | Triggered when the option list is expanded or collapsed, with the callback parameter `(expanded: boolean)`. `expanded` indicates whether the operation will expand or collapse the option list. |
| ``afteropen`` | Triggered after the option list is opened. |
### Icons
| Name | Description |
| -- | -- |
| ``expandable`` | Expandable item. |
### CSS
| Name | Type | Default | Description |
| -- | -- | -- | -- |
| ``--dls-dropdown-max-display-items`` | `<integer>` | `8` | [^css-max-display-items] |
^^^css-max-display-items
When the [`position`](#props-position) prop is set to `popup`, it specifies the maximum number of items that can be displayed at the same time in the dropdown list, and the maximum height of the dropdown box will be calculated based on this.
:::tip
It needs to be set through the [`overlay-style`](#props-overlay-style) prop.
:::
^^^