Foldout
A Foldout control is a collapsible section of a user interface. When toggled, it expands or collapses, which hides or reveals the elements it contains.
Read time 7 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: BindableElement
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IBindable, INotifyValueChanged<bool>
public class Foldout : BindableElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IBindable, INotifyValueChanged<bool>
Remarks
A Foldout consists of a Toggle sub-element and an empty VisualElement. The empty VisualElement is a container for the elements to show/hide when you expand/collapse the foldout. Foldout element's Toggle sub-element uses an arrow sprite instead of the Toggle control's usual checkbox. The arrow points right when the toggle is collapsed and down when it is expanded.
Static Fields
Value | Description |
|---|---|
| checkmarkUssClassName | The USS class name for the Label element in a Foldout. |
| contentUssClassName | The USS class name for the content element in a Foldout. |
| inputUssClassName | The USS class name for the Label element in a Foldout. |
| textUssClassName | The USS class name for the Label element in a Foldout. |
| toggleUssClassName | The USS class name of Toggle sub-elements in Foldout elements. |
| ussClassName | The USS class name for Foldout elements. |
Constructors
Constructor | Description |
|---|---|
| Foldout() | Constructs a Foldout element. |
Properties
Property | Description |
|---|---|
| contentContainer | This element contains the elements that are shown or hidden when you toggle the Foldout. |
| text | The label text for the toggle. |
| toggleOnLabelClick | Whether to toggle the foldout state when the user clicks the label. |
| value | This is the state of the Foldout's toggle. It is true if the Foldout is open and its contents are visible, and false if the Foldout is closed, and its contents are hidden. |
Methods
Method | Description |
|---|---|
| SetValueWithoutNotify | Sets the value of the Foldout's Toggle sub-element, but does not notify the rest of the hierarchy of the change. |