Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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 9 minutesLast updated 2 days ago

Definition

[UxmlElement(libraryPath = "Controls")][Icon("UIToolkit/Icons/Foldout.png")]public class Foldout : BindableElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle, 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

checkmarkUssClassNameThe USS class name for the Label element in a Foldout.
contentUssClassNameThe USS class name for the content element in a Foldout.
inputUssClassNameThe USS class name for the Label element in a Foldout.
textUssClassNameThe USS class name for the Label element in a Foldout.
toggleUssClassNameThe USS class name of Toggle sub-elements in Foldout elements.
ussClassNameThe USS class name for Foldout elements.

Constructors

Constructor

Description

Foldout()Constructs a Foldout element.

Properties

Property

Description

contentContainerThis element contains the elements that are shown or hidden when you toggle the Foldout.
textThe label text for the toggle.
toggleOnLabelClickWhether to toggle the foldout state when the user clicks the label.
valueThis 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

SetValueWithoutNotifySets the value of the Foldout's Toggle sub-element, but does not notify the rest of the hierarchy of the change.

Inheritance

Inherited Members