Box

A box is a generic container that provides managed access to design tokens.

Installation

Package installation information
Installyarn add @atlaskit/primitives
SourceBitbucket.org, (opens new window)
npm@atlaskit/primitives, (opens new window)
Bundleunpkg.com, (opens new window)

Box also supports all valid props as specified by the HTML element type in the as prop. The default is a div, so it would support all valid HTMLDivElement props.

Props

as

Description

The DOM element to render as the Box.

  • This cannot be any SVG-related element such as 'svg', 'animate', 'circle'`, and many more
  • This cannot be a 'a' (use the Anchor primitive instead)
  • This cannot be a 'button' (use the Anchor primitive instead)
Default'div'
Type"object" | "article" | "dialog" | "figure" | "form" | "img" | "link" | "main" | "menu" | "menuitem" | "option" | "search" | "table" | "label" | "style" | "abbr" | "address" | "area" | ... 99 more ... | "set"T

backgroundColor

Description

Token representing background color with a built-in fallback value.

Type"utility.elevation.surface.current" | "elevation.surface" | "elevation.surface.container" | "elevation.surface.overlay" | "elevation.surface.raised" | "elevation.surface.sunken" | ... 223 more ... | "elevation.surface.raised.pressed"

data-testid

Description

data-testid is strictly controlled through the testId prop. This lets consumers know that this data attribute will not be applied.

Typenever

padding

Deprecated
Description

Tokens representing CSS shorthand for paddingBlock and paddingInline together.

@see paddingBlock @see paddingInline @private – Do not use shorthand props, use props.xcss instead as these will be deprecated in the future.

Type"space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000"

paddingBlock

Deprecated
Description

Tokens representing CSS shorthand paddingBlock.

@see paddingBlockStart @see paddingBlockEnd @private – Do not use shorthand props, use props.xcss instead as these will be deprecated in the future.

Type"space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000"

paddingBlockEnd

Deprecated
Description

Tokens representing CSS paddingBlockEnd. @private – Do not use shorthand props, use props.xcss instead as these will be deprecated in the future.

Type"space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000"

paddingBlockStart

Deprecated
Description

Tokens representing CSS paddingBlockStart. @private – Do not use shorthand props, use props.xcss instead as these will be deprecated in the future.

Type"space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000"

paddingInline

Deprecated
Description

Tokens representing CSS shorthand paddingInline. @private – Do not use shorthand props, use props.xcss instead as these will be deprecated in the future.

@see paddingInlineStart @see paddingInlineEnd

Type"space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000"

paddingInlineEnd

Deprecated
Description

Tokens representing CSS paddingInlineEnd. @private – Do not use shorthand props, use props.xcss instead as these will be deprecated in the future.

Type"space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000"

paddingInlineStart

Deprecated
Description

Tokens representing CSS paddingInlineStart. @private – Do not use shorthand props, use props.xcss instead as these will be deprecated in the future.

Type"space.0" | "space.025" | "space.050" | "space.075" | "space.100" | "space.150" | "space.200" | "space.250" | "space.300" | "space.400" | "space.500" | "space.600" | "space.800" | "space.1000"

ref

Description

Forwarded ref.

TypeReact.Ref<HTMLObjectElement> | React.Ref<HTMLElement> | React.Ref<HTMLDialogElement> | React.Ref<HTMLFormElement> | ... 57 more ... | React.Ref<...>ComponentPropsWithRef<T>["ref"]

testId

Description

A unique string that appears as data attribute data-testid in the rendered code, serving as a hook for automated tests.

Typestring

xcss

Description

Apply a subset of permitted styles powered by Atlassian Design System design tokens. It's preferred you do not use background in xcss or cssMap() and instead use props.backgroundColor for surface awareness.

Typefalse | (XCSSValue<"appearance" | "color" | "maxWidth" | "grid" | "borderColor" | "clipPath" | "filter" | "marker" | "mask" | "height" | "width" | "translate" | "content" | "border" | ... 486 more ... | "viewTimeline", DesignTokenStyles, ""> & ... 4 more ... & { ...; })
Was this page helpful?
We use this feedback to improve our documentation.
© 2026 AtlassianTrademark, (opens new window)Privacy, (opens new window)License