Skip to main content
  1. Docs
  2. Components
  3. Layout

Box

A token-only surface: padding, a background, a border and corners. No margin: space between siblings is the parent's gap.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<div>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

box.tsx
// From the package: a build keeps only what it uses.
import { Box } from "@qeetrix/react";

// Or from its own path.
import { Box } from "@qeetrix/react/box";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
padding"none" | "xs" | "sm" | "md" | "lg" | "xl"—Every side, from the inset scale: 0 · 4 · 8 · 12 · 16 · 24px.
paddingInline · paddingBlockInset—Start and end, or top and bottom; over padding.
background"canvas" | "default" | "raised" | "sunken" | "overlay" | "inverse" | "neutral" | "brand" | "selected"—A surface or a tint; inverse sets the text too.
border"none" | "subtle" | "default" | "strong"—A 1px border in a token colour.
radius"none" | "sm" | "control" | "surface" | "overlay" | "modal" | "chip" | "full"—Corners from the radius tokens.
renderReactElementa <div>Another element: <section />.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
box<div>data-background, data-border, data-radius.

04

A landmark

render a <section> or an <aside>, and name it.

tips.tsx
<Box render={<aside />} aria-label="Tips" padding="md" background="sunken" radius="surface">…</Box>
Next — BoxAccessibility