Utilities
Min-Width
The Min-Width
utility in ZoboUI is used to define the minimum width an element can shrink to, especially useful for elements within flexible or self-sizing layouts.
Utility Class | USS Properties |
---|---|
min-w-0 | min-width: 0px; |
min-w-1 | min-width: 4px; |
min-w-2 | min-width: 8px; |
min-w-3 | min-width: 12px; |
min-w-4 | min-width: 16px; |
min-w-5 | min-width: 20px; |
min-w-6 | min-width: 24px; |
min-w-7 | min-width: 28px; |
min-w-8 | min-width: 32px; |
min-w-9 | min-width: 36px; |
min-w-10 | min-width: 40px; |
min-w-11 | min-width: 44px; |
min-w-12 | min-width: 48px; |
min-w-14 | min-width: 56px; |
min-w-16 | min-width: 64px; |
min-w-20 | min-width: 80px; |
min-w-24 | min-width: 96px; |
min-w-28 | min-width: 112px; |
min-w-32 | min-width: 128px; |
min-w-36 | min-width: 144px; |
min-w-40 | min-width: 160px; |
min-w-44 | min-width: 176px; |
min-w-48 | min-width: 192px; |
min-w-52 | min-width: 208px; |
min-w-56 | min-width: 224px; |
min-w-60 | min-width: 240px; |
min-w-64 | min-width: 256px; |
min-w-72 | min-width: 288px; |
min-w-80 | min-width: 320px; |
min-w-96 | min-width: 384px; |
min-w-px | min-width: 1px; |
min-w-0point5 | min-width: 2px; |
min-w-1point5 | min-width: 6px; |
min-w-2point5 | min-width: 10px; |
min-w-3point5 | min-width: 14px; |
min-w-full | min-width: 100%; |
min-w-auto | min-width: auto; |
Basic Usage in UXML
To use the Min-Width
utility, apply the class min-w-{size}
to an element. For example, min-w-0
sets the minimum width to 0. It's useful for making an element completely collapsible in the width dimension.
<ui:VisualElement class="min-w-0">
<!-- Element that can collapse to zero width -->
</ui:VisualElement>
Customize
Modifier Variations
You can customize which modifier variations of the Min-Width
utility are generated, such as pseudo-classes (e.g., hover
, focus
) and custom modifiers.
Min-Width
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
Min-Width
utility. - 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 Min-Width
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 Min-Width
utility:
- min-w : min-width
To customize these tags and properties, you can edit the Tag Property Map
field for the Min-Width
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 Min-Width
utility uses values from the following fields from the Core
section of the Theme Config asset:
- Spacing
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
Min-Width
utility. - Customize Extend Fields: Modify or add fields in the
Extend Fields
array to change the core configuration values that are extended. You'll only be able to extend fields of the same type.
Disable Utility
The Min-Width
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.