Skip to content

Box

Box

A neutral container. Use it when you need spacing without semantics.

<Box p={4}>16px padding all sides</Box>
<Box px={6} py={4}>24px inline, 16px block</Box>
<Box p="2rem">Raw CSS still works</Box>

Install: @helixui/core

import { Box } from '@helixui/core'

status: stable · since: 0.1.0

Tags: primitive, container, spacing, utility

Anatomy

[ <children> ] ← unstyled container with padding/margin shorthands

Layout

  • displayblock
  • widthauto
  • heightauto
  • intrinsicSizecontent size; tunable padding/margin via props
  • stackabletrue
  • fullBleedfalse

Visual

A presentational <div> with token-aware padding (p, px, py, …) and margin shorthands. No background, border, or radius by default — strictly a layout primitive.

Props

NameTypeDefaultDescription
pnumber | stringPadding on all sides. Numeric input → space.N token; string passes through as raw CSS.
pxnumber | stringInline (left+right) padding.
pynumber | stringBlock (top+bottom) padding.
mnumber | stringMargin on all sides.
mxnumber | stringInline margin.
mynumber | stringBlock margin.
...restHTMLAttributes<HTMLDivElement>Native div attributes.

Tokens used

space.0, space.1, space.2, space.3, space.4, space.5, space.6, space.8, space.10, space.12, space.16, space.20, space.24

Accessibility

Notes

  • Box is presentational. Use a semantic element where possible (<section>, <article>, etc.).

Composes with

ComponentRelationNote
StackalternativeUse Stack when you want a flex column/row of children.
FlexalternativeUse Flex for explicit flexbox layout.
GridalternativeUse Grid for 2-D layout.

Prompt examples

These are the AI prompt → JSX mappings used by the helixui prompt DSL and integrations like Cursor / Claude Code.

pad a section

“add 24px of padding around this group”

<Box p={6}>{children}</Box>

horizontal rule of margin

“add top margin”

<Box mt={4}>{children}</Box>