Skip to content
Playground

Box

A minimal polymorphic structural wrapper.

Box is the lowest-level Zenos layout primitive. It gives a semantic element a stable slot and optional elevation while leaving spacing, sizing, borders, and display behavior to the consumer.

Workspace summary

Activity across all environments

Healthy

Projects

18

Contributors

42

Deployments

126

TSX
import { Box } from "@zentara-co/zenos-ui";

Elevation describes the surface’s relationship to surrounding content. It applies semantic surface tokens and, where appropriate, shadows and interaction states.

Level −1

sunken

Recessed regions

Level 0

surface

Page surface

Level +1

container

Grouped content

Level +2

raised

Floating controls

Level +3

overlay

Temporary layers

Use the levels consistently:

  • sunken for recessed wells and inset regions
  • surface for the standard content plane
  • container for grouped content on a surface
  • raised for elements lifted above nearby content
  • overlay for the highest temporary surfaces

Elevation adds visual hierarchy; it does not add layout, dialog behavior, or stacking context.

Use as to choose the correct semantic element. Native attributes and the forwarded ref follow that element, so an anchor accepts href, an article retains article semantics, and a section can use aria-labelledby.

Review
Incident report

Rendered as a semantic article with its own heading.

Read the Box API

A native link with href and visible focus behavior.

Use Box when semantic wrapping, elevation, or a stable customization hook is enough. Use Stack, Grid, Center, Container, or Section when the structure has a repeated layout rule. One-off application styling belongs in className:

TSX
<Box as="aside" className="rounded-xl border border-border p-4">  ...</Box>

API

PropTypeDefaultDescription
as ElementType div Rendered semantic element and source of native prop and ref types.
elevation sunken | surface | container | raised | overlay — Optional semantic surface level, including interaction states and shadows.
native props React.HTMLAttributes<HTMLElement> — Forwards native attributes, events, aria-*, data-*, className, style, and ref.

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

Box adds no role or interaction behavior. Choose as for the content’s meaning and preserve native semantics. If styling Box as an interactive surface, render an actual link or button rather than adding click behavior to a div, and keep a visible focus indicator.