Skip to content
Playground

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:

  • comfortable is the default. It preserves the balanced spacing used by existing Zenos components.
  • compact reduces whitespace for dashboards, data-heavy forms, side panels, and other application UI.

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.

Radius and color stay the same.

compact

Tighter spacing for information-dense workflows.

Radius and color stay the same.

Use an explicit density prop when one component needs to differ from its surroundings:

TSX
<Card density="compact">  <Card.Header>    <Card.Title>Recent activity</Card.Title>  </Card.Header>  <Card.Content>{/* dense content */}</Card.Content></Card>

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.

TSX
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:

  1. An explicit component density prop.
  2. The nearest DensityProvider.
  3. The comfortable default.

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".

  • 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.
  • 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.

The first density-aware surface is the Card family:

  • Card
  • ClickableCard
  • SelectableCard

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.

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.