ToggleButtonGroup
A control that allows single or multiple selection out of a logical group of Button elements.
Read time 7 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: BaseField<ToggleButtonGroupState>
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IBindable, INotifyValueChanged<ToggleButtonGroupState>, IMixedValueSupport
[UxmlElement(null, new Type[] { typeof(Button) })]public class ToggleButtonGroup : BaseField<ToggleButtonGroupState>, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IBindable, INotifyValueChanged<ToggleButtonGroupState>, IMixedValueSupport
Remarks
The ToggleButtonGroup has a label and a group of interactable Button elements.
To create buttons, add Button elements directly to the ToggleButtonGroup. This will automatically style and configure the button to work properly.
Static Fields
Value | Description |
|---|---|
| buttonClassName | USS class name for any Buttons in the group. |
| buttonGroupClassName | USS class name of container element of this type. |
| buttonLeftClassName | USS class name for the leftmost Button in the group. |
| buttonMidClassName | USS class name for any Buttons in the middle of the group. |
| buttonRightClassName | USS class name for the rightmost Button in the group. |
| buttonStandaloneClassName | USS class name for the Button if only one is available in the group. |
| containerUssClassName | USS class name of container element of this type. |
| emptyStateLabelClassName | USS class name for empty state label. |
| ussClassName | USS class name of elements for this type. |
Constructors
Constructor | Description |
|---|---|
| ToggleButtonGroup() | Constructs a ToggleButtonGroup. |
| ToggleButtonGroup(System.String) | Constructs a ToggleButtonGroup. |
| ToggleButtonGroup(System.String,UnityEngine.UIElements.ToggleButtonGroupState) | Constructs a ToggleButtonGroup. |
| ToggleButtonGroup(UnityEngine.UIElements.ToggleButtonGroupState) | Constructs a ToggleButtonGroup. |
Properties
Property | Description |
|---|---|
| allowEmptySelection | Allows having all buttons to be unchecked when set to true. |
| isMultipleSelection | Whether all buttons can be selected. |
Methods
Method | Description |
|---|---|
| SetValueWithoutNotify | Sets a new value without triggering any change event. |