Utilities

Background Radius

The Background Radius utility is designed to control the rounding of corners on UI elements. This utility offers a range of options to create soft, rounded edges.

Utility Class
USS Properties
rounded-none
border-radius: 0;
rounded-sm
border-radius: 2px;
rounded
border-radius: 4px;
rounded-md
border-radius: 6px;
rounded-lg
border-radius: 8px;
rounded-xl
border-radius: 12px;
rounded-2xl
border-radius: 16px;
rounded-3xl
border-radius: 24px;
rounded-full
border-radius: 9999px;
rounded-t-none
border-top-left-radius: 0;
border-top-right-radius: 0;
rounded-t-sm
border-top-left-radius: 2px;
border-top-right-radius: 2px;
rounded-t
border-top-left-radius: 4px;
border-top-right-radius: 4px;
rounded-t-md
border-top-left-radius: 6px;
border-top-right-radius: 6px;
rounded-t-lg
border-top-left-radius: 8px;
border-top-right-radius: 8px;
rounded-t-xl
border-top-left-radius: 12px;
border-top-right-radius: 12px;
rounded-t-2xl
border-top-left-radius: 16px;
border-top-right-radius: 16px;
rounded-t-3xl
border-top-left-radius: 24px;
border-top-right-radius: 24px;
rounded-t-full
border-top-left-radius: 9999px;
border-top-right-radius: 9999px;
rounded-r-none
border-top-right-radius: 0;
border-bottom-right-radius: 0;
rounded-r-sm
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
rounded-r
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
rounded-r-md
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
rounded-r-lg
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
rounded-r-xl
border-top-right-radius: 12px;
border-bottom-right-radius: 12px;
rounded-r-2xl
border-top-right-radius: 16px;
border-bottom-right-radius: 16px;
rounded-r-3xl
border-top-right-radius: 24px;
border-bottom-right-radius: 24px;
rounded-r-full
border-top-right-radius: 9999px;
border-bottom-right-radius: 9999px;
rounded-b-none
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
rounded-b-sm
border-bottom-right-radius: 2px;
border-bottom-left-radius: 2px;
rounded-b
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
rounded-b-md
border-bottom-right-radius: 6px;
border-bottom-left-radius: 6px;
rounded-b-lg
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
rounded-b-xl
border-bottom-right-radius: 12px;
border-bottom-left-radius: 12px;
rounded-b-2xl
border-bottom-right-radius: 16px;
border-bottom-left-radius: 16px;
rounded-b-3xl
border-bottom-right-radius: 24px;
border-bottom-left-radius: 24px;
rounded-b-full
border-bottom-right-radius: 9999px;
border-bottom-left-radius: 9999px;
rounded-l-none
border-top-left-radius: 0;
border-bottom-left-radius: 0;
rounded-l-sm
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
rounded-l
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
rounded-l-md
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
rounded-l-lg
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
rounded-l-xl
border-top-left-radius: 12px;
border-bottom-left-radius: 12px;
rounded-l-2xl
border-top-left-radius: 16px;
border-bottom-left-radius: 16px;
rounded-l-3xl
border-top-left-radius: 24px;
border-bottom-left-radius: 24px;
rounded-l-full
border-top-left-radius: 9999px;
border-bottom-left-radius: 9999px;
rounded-tl-none
border-top-left-radius: 0;
rounded-tl-sm
border-top-left-radius: 2px;
rounded-tl
border-top-left-radius: 4px;
rounded-tl-md
border-top-left-radius: 6px;
rounded-tl-lg
border-top-left-radius: 8px;
rounded-tl-xl
border-top-left-radius: 12px;
rounded-tl-2xl
border-top-left-radius: 16px;
rounded-tl-3xl
border-top-left-radius: 24px;
rounded-tl-full
border-top-left-radius: 9999px;
rounded-tr-none
border-top-right-radius: 0;
rounded-tr-sm
border-top-right-radius: 2px;
rounded-tr
border-top-right-radius: 4px;
rounded-tr-md
border-top-right-radius: 6px;
rounded-tr-lg
border-top-right-radius: 8px;
rounded-tr-xl
border-top-right-radius: 12px;
rounded-tr-2xl
border-top-right-radius: 16px;
rounded-tr-3xl
border-top-right-radius: 24px;
rounded-tr-full
border-top-right-radius: 9999px;
rounded-br-none
border-bottom-right-radius: 0;
rounded-br-sm
border-bottom-right-radius: 2px;
rounded-br
border-bottom-right-radius: 4px;
rounded-br-md
border-bottom-right-radius: 6px;
rounded-br-lg
border-bottom-right-radius: 8px;
rounded-br-xl
border-bottom-right-radius: 12px;
rounded-br-2xl
border-bottom-right-radius: 16px;
rounded-br-3xl
border-bottom-right-radius: 24px;
rounded-br-full
border-bottom-right-radius: 9999px;
rounded-bl-none
border-bottom-left-radius: 0;
rounded-bl-sm
border-bottom-left-radius: 2px;
rounded-bl
border-bottom-left-radius: 4px;
rounded-bl-md
border-bottom-left-radius: 6px;
rounded-bl-lg
border-bottom-left-radius: 8px;
rounded-bl-xl
border-bottom-left-radius: 12px;
rounded-bl-2xl
border-bottom-left-radius: 16px;
rounded-bl-3xl
border-bottom-left-radius: 24px;
rounded-bl-full
border-bottom-left-radius: 9999px;

Specific Corner Radius Classes

Additionally, ZoboUI generates classes for applying radius to specific corners, such as rounded-t-none, rounded-r-sm, rounded-b-lg, and rounded-l-full.

Basic Usage in UXML

Element with Rounded Corners

<ui:VisualElement class="rounded-none"></ui:VisualElement>
<ui:VisualElement class="rounded-sm"></ui:VisualElement>
<ui:VisualElement class="rounded-lg"></ui:VisualElement>

Element with Specific Rounded Corners

<ui:VisualElement class="rounded-t-lg"></ui:VisualElement>
<ui:VisualElement class="rounded-br-lg"></ui:VisualElement>

Customize

Modifier Variations

Modifier Variations

You can customize which modifier variations of the Border Radius utility are generated, such as pseudo-classes (e.g., hover, focus) and custom modifiers.

By default, no modifier variations are defined for the Border Radius 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:

  1. Open the Theme Config Asset: Find the asset within your Unity project.
  2. Navigate to the 'Utilities' Section: Locate the Border Radius utility.
  3. 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

Class Tags and Properties

The Border Radius 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 Border Radius utility:

  • rounded : border-radius
  • rounded-t : border-top-left-radius, border-top-right-radius
  • rounded-r : border-top-right-radius, border-bottom-right-radius
  • rounded-b : border-bottom-right-radius, border-bottom-left-radius
  • rounded-l : border-top-left-radius, border-bottom-left-radius
  • rounded-tl : border-top-left-radius
  • rounded-tr : border-top-right-radius
  • rounded-br : border-bottom-right-radius
  • rounded-bl : border-bottom-left-radius

To customize these tags and properties, you can edit the Tag Property Map field for the Border Radius 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 Border Radius 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:

  1. Open the Theme Config Asset: Locate the asset within your Unity project.
  2. Navigate to the 'Utilities' Section: Find the Border Radius utility.
  3. 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 Border Radius 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.

Previous
Border Color