2020-08-13 11:47:56 +08:00
# OptionGroup <small>选择组</small>
:::tip
`Option` is required to be used within [`Select` ](./select ), [`Dropdown` ](./dropdown ) or other `OptionGroup` , and can be used with [`Option` ](./option ).
:::
## Demos
See [the demos of `Select` ](./select#demos ) or [the demos of `Dropdown` ](./dropdown#demos ).
## API
### Props
| Name | Type | Default | Description |
| -- | -- | -- | -- |
2021-10-20 01:11:27 +08:00
| ``label`` | `string` | The descriptive label of the option group. |
| ``options`` | `Array<Object>` | `[]` | [^options] |
| ``position`` | `string` | `inline` | [^position] |
| ``overlay-class`` | `string | Array | Object=` | - | See the [`overlay-class` ](./overlay#props-overlay-class ) prop of the [`Overlay` ](./overlay ) component. |
| ``overlay-style`` | `string | Array | Object=` | - | See the [`overlay-style` ](./overlay#props-overlay-style ) prop of the [`Overlay` ](./overlay ) component. |
2020-08-13 11:47:56 +08:00
^^^options
The list of options with the option type being `{label, value, disabled, ...}` .
+++Properties
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The descriptive label of the option. |
| `value` | `*` | The value of the option. |
| `disabled` | `boolean=` | Whether the option is disabled. |
+++
^^^
^^^position
The way to display child options.
+++Enum values
| Value | Description |
| -- | -- |
| `inline` | Displays child options inline. |
| `popup` | Displays child options in a separate popup menu. |
+++
^^^
### Slots
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``default`` | The content of the options dropdown. Can be used to place `Option` s or `OptionGroups` s when the [`options` ](#props-options ) prop is not specified. |
| ``label`` | [^slot-label] |
| ``group-label`` | [^slot-group-label] |
| ``option-label`` | [^slot-option-label] |
| ``option`` | [^slot-option] |
2020-08-13 11:47:56 +08:00
2020-12-22 16:33:30 +08:00
^^^slot-label
2021-10-20 01:11:27 +08:00
The label of the option group. Displays the [`label` ](#props-label ) prop by default.
2020-08-13 11:47:56 +08:00
2022-01-24 18:53:52 +08:00
+++Slot props
2020-08-13 11:47:56 +08:00
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The descriptive label of the option group. |
| `disabled` | `boolean=` | Whether the option group is disabled. |
+++
^^^
2020-12-22 16:33:30 +08:00
^^^slot-group-label
2020-08-13 11:47:56 +08:00
The label text of each option group (option with child `options` ). Displays the `label` of the option by default.
2022-01-24 18:53:52 +08:00
+++Slot props
2020-08-13 11:47:56 +08:00
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The descriptive label of the option group. |
| `disabled` | `boolean=` | Whether the option group is disabled. |
+++
2022-01-24 18:53:52 +08:00
Additionally, custom properties in current option, apart from the listed ones, will also be passes into the slot props object via `v-bind` .
2020-08-13 11:47:56 +08:00
^^^
2020-12-22 16:33:30 +08:00
^^^slot-option-label
2020-08-13 11:47:56 +08:00
The label text of each option (option without child `options` ). Displays the `label` of the option by default.
2022-01-24 18:53:52 +08:00
+++Slot props
2020-08-13 11:47:56 +08:00
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The descriptive label of the option. |
| `value` | `*` | The value of the option. |
| `selected` | `boolean` | Whether the the option is selected. |
| `disabled` | `boolean=` | Whether the option is disabled. |
+++
2022-01-24 18:53:52 +08:00
Additionally, custom properties in current option, apart from the listed ones, will also be passes into the slot props object via `v-bind` .
2020-08-13 11:47:56 +08:00
^^^
2020-12-22 16:33:30 +08:00
^^^slot-option
2020-08-13 11:47:56 +08:00
The entire content area of each option (option without child `options` ). Displays the default content of `Options` component by default.
2022-01-24 18:53:52 +08:00
+++Slot props
2020-08-13 11:47:56 +08:00
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The descriptive label of the option. |
| `value` | `*` | The value of the option. |
| `selected` | `boolean` | Whether the the option is selected. |
| `disabled` | `boolean=` | Whether the option is disabled. |
+++
2022-01-24 18:53:52 +08:00
Additionally, custom properties in current option, apart from the listed ones, will also be passes into the slot props object via `v-bind` .
2020-08-13 11:47:56 +08:00
^^^
### Icons
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``expandable`` | Expandable options. |