Class PropertyGroup
A collapsible group of inspector rows.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class PropertyGroup : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
The title sits on the text line with no caret, which is what keeps a column of groups reading as
text rather than as a tree; a closed group that has something in it shows an ellipsis after its
label instead. Rows inside are --appui-alias-inspector-row-gap apart, so a stack of
InputLabel rows in Grid keeps one rhythm across
groups.
An empty group is not a disclosure: it has nothing to expand, so its header is disabled and shows no ellipsis rather than claiming to be open. A group whose rows are laid out elsewhere sets expandable to keep its toggle. Use PropertyGroupStack for the column a panel stacks its sections in.
This is not an AccordionItem: an accordion is a list of disclosures with carets, one of which is open, while a property group is a titled span of an inspector that happens to fold away.
Examples
A section with a nested sub-group of rows.
<appui:PropertyGroupStack>
<appui:PropertyGroup label="Transform" level="Section">
<appui:InputLabel label="Position" row-layout="Grid">
<appui:Vector3Field />
</appui:InputLabel>
<appui:PropertyGroup label="Advanced">
<appui:InputLabel label="Static" row-layout="Grid">
<appui:Checkbox />
</appui:InputLabel>
</appui:PropertyGroup>
</appui:PropertyGroup>
</appui:PropertyGroupStack>
Constructors
PropertyGroup()
Initializes a new instance of the PropertyGroup class.
Declaration
public PropertyGroup()
Fields
contentUssClassName
The styling class of the PropertyGroup's content.
Declaration
public const string contentUssClassName = "appui-property-group__content"
Field Value
| Type | Description |
|---|---|
| string |
ellipsisUssClassName
The styling class of the ellipsis a closed PropertyGroup shows after its label.
Declaration
public const string ellipsisUssClassName = "appui-property-group__ellipsis"
Field Value
| Type | Description |
|---|---|
| string |
emptyUssClassName
The PropertyGroup styling class applied while it has nothing to show.
Declaration
public const string emptyUssClassName = "appui-property-group--empty"
Field Value
| Type | Description |
|---|---|
| string |
headerUssClassName
The styling class of the PropertyGroup's header row, which holds the toggle and the trailing slot.
Declaration
public const string headerUssClassName = "appui-property-group__header"
Field Value
| Type | Description |
|---|---|
| string |
labelUssClassName
The styling class of the PropertyGroup's label.
Declaration
public const string labelUssClassName = "appui-property-group__label"
Field Value
| Type | Description |
|---|---|
| string |
levelUssClassName
The PropertyGroup level styling class.
Declaration
public const string levelUssClassName = "appui-property-group--level-"
Field Value
| Type | Description |
|---|---|
| string |
openUssClassName
The PropertyGroup styling class applied while it is open.
Declaration
public const string openUssClassName = "appui-property-group--open"
Field Value
| Type | Description |
|---|---|
| string |
toggleUssClassName
The styling class of the PropertyGroup's header toggle.
Declaration
public const string toggleUssClassName = "appui-property-group__toggle"
Field Value
| Type | Description |
|---|---|
| string |
trailingContainerUssClassName
The styling class of the PropertyGroup's trailing slot.
Declaration
public const string trailingContainerUssClassName = "appui-property-group__trailing-container"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The PropertyGroup main styling class.
Declaration
public const string ussClassName = "appui-property-group"
Field Value
| Type | Description |
|---|---|
| string |
withTrailingUssClassName
The PropertyGroup styling class applied while it has trailing content beside its title.
Declaration
public const string withTrailingUssClassName = "appui-property-group--with-trailing"
Field Value
| Type | Description |
|---|---|
| string |
withoutRowsUssClassName
The PropertyGroup styling class applied while it has no rows of its own, whether or not it is expandable. Its content then takes no space below the header.
Declaration
public const string withoutRowsUssClassName = "appui-property-group--without-rows"
Field Value
| Type | Description |
|---|---|
| string |
Properties
clickable
The Pressable manipulator of the header toggle.
Declaration
[CreateProperty]
public Pressable clickable { get; set; }
Property Value
| Type | Description |
|---|---|
| Pressable |
contentContainer
Logical container where child elements are added. If a child is added to this element, the child is added to this element's content container instead.
Declaration
public override VisualElement contentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Overrides
expandable
Whether the group has content laid out elsewhere, rows another element places (a timeline's gutter, say), so its header toggles and shows the closed-state ellipsis without children of its own. Without it a group toggles only while it has children. False by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool expandable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
The group only reports the state through open and openChanged; showing and hiding the rows it stands for is the host's job.
hasContent
Whether the group has anything to show: children of its own, or expandable content laid out elsewhere.
Declaration
public bool hasContent { get; }
Property Value
| Type | Description |
|---|---|
| bool |
headerElement
The header row, holding the toggle and the trailing slot. Exposed for a host that wants to mark it as a drop target.
Declaration
public VisualElement headerElement { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
label
The group's title.
Declaration
[CreateProperty]
[UxmlAttribute]
public string label { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
level
Declaration
[CreateProperty]
[UxmlAttribute]
public PropertyGroupLevel level { get; set; }
Property Value
| Type | Description |
|---|---|
| PropertyGroupLevel |
open
Whether the group is showing its rows. Open by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool open { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
toggleElement
The header toggle: the press target that folds the group. Exposed for a host's own hit-testing.
Declaration
public VisualElement toggleElement { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
trailingContainer
The slot at the end of the header line, outside the toggle. Content added here does not inherit the toggle's press target, so a control in it can be clicked without folding the group.
Declaration
public VisualElement trailingContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Remarks
Call RefreshTrailing() after adding to or removing from it if the state is needed before the next layout pass.
Methods
GetLevelUssClassName(PropertyGroupLevel)
Declaration
public static string GetLevelUssClassName(PropertyGroupLevel enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| PropertyGroupLevel | enumValue |
Returns
| Type | Description |
|---|---|
| string |
RefreshTrailing()
Re-reads whether the group has content and whether it has a trailing slot.
Declaration
public void RefreshTrailing()
Remarks
This runs on every layout pass of either. Call it directly only after mutating them when the state is needed before the next pass.
SetOpenWithoutNotify(bool)
Sets the open state without raising openChanged.
Declaration
public void SetOpenWithoutNotify(bool newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | newValue | The new open state. |
Toggle()
Folds the group if it is open, unfolds it otherwise.
Declaration
public void Toggle()
Events
openChanged
Event raised when the group has been folded or unfolded, with the new state.
Declaration
public event Action<bool> openChanged
Event Type
| Type | Description |
|---|---|
| Action<bool> |