Sizing Utilities
NuvoUI provides a comprehensive set of utilities for controlling the dimensions of elements, including width, height, min/max constraints, and viewport-relative measurements.
Configuration
The sizing utilities are built on a set of configurable variables:
Spacings
Width and height utilities are generated from the VAR.$spacings
map, which defines various size values:
Percentages
Percentage-based sizing utilities are generated from the VAR.$percentages
list:
Breakpoints
Responsive variants of sizing utilities are generated based on the breakpoint values defined in the VAR.$breakpoints
map:
Utility Class Generation
Sizing utility classes are only generated if VAR.$generate-utility-classes
is set to true
:
Parent Selector
All utility classes are scoped under the VAR.$parent-selector
which can be configured to change the global selector context:
Utility Class Naming Convention
NuvoUI's sizing utilities follow a consistent naming pattern:
- Width classes: Start with
w-
(e.g.,w-full
,w-64
) - Height classes: Start with
h-
(e.g.,h-full
,h-32
) - Min-width classes: Start with
min-w-
(e.g.,min-w-full
) - Min-height classes: Start with
min-h-
(e.g.,min-h-full
) - Max-width classes: Start with
max-w-
(e.g.,max-w-full
) - Max-height classes: Start with
max-h-
(e.g.,max-h-full
) - Percentage values: End with
p
(e.g.,w-50p
for 50% width) - Responsive variants: Use the
@breakpoint
suffix (e.g.,w-full@md
)
Available Types of Sizing Utilities
NuvoUI provides several categories of sizing utilities:
- Fixed sizing: Apply specific width or height values (e.g.,
w-64
,h-32
) - Percentage sizing: Apply percentage-based dimensions (e.g.,
w-50p
,h-75p
) - Special values: Apply common sizing values like
auto
,full
,screen
- Content-based sizing: Set dimensions based on content (
min-content
,max-content
,fit-content
) - Viewport-based sizing: Set dimensions relative to the viewport (
w-screen
,h-screen
) - Constraints: Apply minimum and maximum constraints (
min-w-
,max-w-
,min-h-
,max-h-
)
When to Use Each Type of Sizing Utility
- Fixed sizing: When you need precise control over element dimensions
- Percentage sizing: For responsive layouts that scale with their container
- Special values: For common use cases like taking up full width or adapting to content
- Content-based sizing: When you need elements to size based on their content
- Viewport-based sizing: For full-screen sections or viewport-relative dimensions
- Constraints: When you need to control minimum or maximum dimensions
For specific documentation on each category, see the Width Utilities and Height Utilities pages.