Utilities
Display
The Display utility is crucial for defining how elements are displayed within the layout. This utility impacts both the visibility and arrangement of UI elements.
Utility Class | USS Properties |
|---|---|
| flex | display: flex; |
| hidden | display: none; |
Basic Usage in UXML
Flex
The element behaves like a block-level element and lays out its content according to the flexbox model. This is optimal for user interface design, allowing flexible arrangement and sizing of child elements.
<ui:VisualElement class="flex">
<!-- Element displayed as a flex container -->
</ui:VisualElement>
Hidden
Hides the element from the UI, effectively removing it from the layout flow.
<ui:VisualElement class="hidden">
<!-- Element hidden from the UI -->
</ui:VisualElement>
Customize
Modifier Variations

You can customize which modifier variations of the Display utility are generated, such as pseudo-classes (e.g., hover, focus) and custom modifiers.
Display utility.By fine-tuning the utility variations, you maintain control over your stylesheet's size and complexity, ensuring that only necessary styles are included. To update these values:
- Open the Theme Config Asset: Find the asset within your Unity project.
- Navigate to the 'Utilities' Section: Locate the
Displayutility. - Adjust Modifier Variations: Select which modifiers you want to be generated for the utility. Keep in mind that the order of the modifiers will affect the order and specificity of the generated USS classes.
Class Tags and Properties

The Display utility generates classes based on predefined tags and their associated USS properties. While we recommend keeping these defaults for consistency and ease of reference in our documentation, you have the option to customize them to suit your project's specific needs.
These values are prepended to the defined values in this format tag-{value}. If a tag is empty, the generated class will simply be the value by itself.
Here are the default tags and the USS properties they set for the Display utility:
- No Tag : display
To customize these tags and properties, you can edit the Tag Property Map field for the Display utility in the Theme Config asset. This allows you to define new tags or modify existing ones, thus tailoring the generated classes to your preferences.
Extending Core Fields
The Display utility does not extend any fields from the Core section of the Theme Config asset. Before you try to extend any fields, we recommend checking Unity's documentation to verify which types of values are expected by the relevant USS properties.
To customize or define these extended fields:
- Open the Theme Config Asset: Locate the asset within your Unity project.
- Navigate to the 'Utilities' Section: Find the
Displayutility. - Customize Extend Fields: Modify or add fields in the
Extend Fieldsarray to change the core configuration values that are extended. You'll only be able to extend fields of the same type.
Disable Utility
The Display utility is enabled by default. You can disable it by unchecking the Enabled option in the Theme Config asset. This will prevent the generation of the utility's styles.