Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Box

A plan summary built from a token-aware surface primitive.

Preview

Live preview

Changes apply to this preview only.

Team plan

Everything a growing team needs.

per month€24
Unlimited projectsShared themesPriority support
TipSpace with tokens

Spacing follows the shared token scale. Use named aliases when the exact step matters less than a consistent rhythm.

A nested box resets the rhythm.
New
Three files changedReview the pull request before the next release.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Padding scale

0, 1, 2, 3, 4, 6, 8 and 12 map to --pimolu-spacing-* tokens; the surface makes the padded area visible.

Open preview

Axes

paddingX and paddingY refine the inline and block axes; p, px and py are aliases.

Open preview

Surfaces

Only the semantic surface and muted tokens are available, so every preset and both themes stay consistent.

Open preview

Usage

Use Box for layout and surface composition, not as a substitute for a semantic button or link.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluBoxProps

Type source
PimoluBoxProps public API
NameTypeDefaultDescription
asElementType | undefined`div`Element rendered by the Box. Defaults to `div`.
paddingPimoluBoxSpace | undefined—Padding on every side.
pPimoluBoxSpace | undefined—Shorthand for `padding`.
paddingXPimoluBoxSpace | undefined—Horizontal padding; wins over `padding` on the inline axis.
pxPimoluBoxSpace | undefined—Shorthand for `paddingX`.
paddingYPimoluBoxSpace | undefined—Vertical padding; wins over `padding` on the block axis.
pyPimoluBoxSpace | undefined—Shorthand for `paddingY`.
backgroundPimoluBoxBackground | undefined`none` (transparent)Semantic surface tint. Defaults to `none` (transparent).
fullWidthboolean | undefinedfalseFill the available inline size.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onChangeChangeEventHandler<HTMLElement, Element> | undefined—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLElement> | undefined—Standard React/HTML attribute.
as

ElementType | undefined

Default: `div`

Element rendered by the Box. Defaults to `div`.

padding

PimoluBoxSpace | undefined

No default extracted.

Padding on every side.

p

PimoluBoxSpace | undefined

No default extracted.

Shorthand for `padding`.

paddingX

PimoluBoxSpace | undefined

No default extracted.

Horizontal padding; wins over `padding` on the inline axis.

px

PimoluBoxSpace | undefined

No default extracted.

Shorthand for `paddingX`.

paddingY

PimoluBoxSpace | undefined

No default extracted.

Vertical padding; wins over `padding` on the block axis.

py

PimoluBoxSpace | undefined

No default extracted.

Shorthand for `paddingY`.

background

PimoluBoxBackground | undefined

Default: `none` (transparent)

Semantic surface tint. Defaults to `none` (transparent).

fullWidth

boolean | undefined

Default: false

Fill the available inline size.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onChange

ChangeEventHandler<HTMLElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Choose the appropriate underlying semantic element and preserve reading order.
Read the accessibility guide →