Density
Retune component spacing and default control sizes for comfortable or compact interfaces.
Density is a cross-component spacing preset. It tightens or relaxes padding, gaps, title scale, and default control heights without changing color, radius, or interaction behavior.
Zenos provides two values:
comfortableis the default. It preserves the balanced spacing used by existing Zenos components.compactreduces whitespace for dashboards, data-heavy forms, side panels, and other application UI.
Compare the presets
Section titled “Compare the presets”The same Card is rendered at both densities below. The compact version reduces its internal spacing and title scale while keeping the same semantic surface, border, and corner radius.
comfortable
Balanced spacing for everyday product surfaces.
compact
Tighter spacing for information-dense workflows.
Use an explicit density prop when one component needs to differ from its surroundings:
<Card density="compact"> <Card.Header> <Card.Title>Recent activity</Card.Title> </Card.Header> <Card.Content>{/* dense content */}</Card.Content></Card>Set density for a subtree
Section titled “Set density for a subtree”DensityProvider applies one density to every supported descendant. This is the preferred option for a dashboard, settings panel, or application shell because related components change together.
Payout threshold
Choose when the next automatic payout is created.
import { Button, Card, DensityProvider, Input } from "@zentara-co/zenos-ui"; export function Dashboard({ children }: { children: React.ReactNode }) { return <DensityProvider density="compact">{children}</DensityProvider>;}Density resolves from the most specific source:
- An explicit component
densityprop. - The nearest
DensityProvider. - The
comfortabledefault.
For controls with a size prop, an explicit size remains authoritative. A compact provider changes an unsized Button or Input to sm, but it does not replace size="lg".
What changes
Section titled “What changes”Comfortable
Section titled “Comfortable”- Card regions use the spacing-4 token (
p-4, 16px) on every outer edge. - Card titles use the body-large scale.
- Unsized Button and Input controls resolve to
md.
Compact
Section titled “Compact”- Card regions use the spacing-3 token (
p-3, 12px) on every outer edge. - Card titles use the body-medium scale.
- Unsized Button and Input controls resolve to
sm.
Density does not change semantic color roles, border radius, component variants, accessibility behavior, or touch-target decisions that a product applies explicitly.
Supported components
Section titled “Supported components”The first density-aware surface is the Card family:
CardClickableCardSelectableCard
Because the interactive card components share Card parts, their headers, content, footers, and nested controls inherit the same density behavior. Button and Input also honor the provider when their size prop is omitted.
Components with intrinsic pixel dimensions, such as Avatar, do not inherit density. Continue to use their explicit size API.
Choosing a density
Section titled “Choosing a density”Use comfortable for marketing surfaces, onboarding, editorial content, and focused tasks where scanning space is valuable. Use compact for repeated controls, dense configuration, data management, and constrained panels.
Keep one density across a coherent region. Mixing presets card by card creates uneven rhythm; use a local override only when the component has a genuinely different information-density requirement.