Box
A generic container that provides a flexible alternative for custom designs not achievable with existing components. Use it to apply styling such as backgrounds, padding, or borders, or to nest and group other components. The contents of Box always maintain their natural size, making it especially useful within layout components that would otherwise stretch their children.
Anchor to propertiesProperties
- Anchor to accessibilityLabelaccessibilityLabelstring
A label that describes the purpose or contents of the element. When set, it will be announced to users using assistive technologies and will provide them with more context.
Only use this when the element's content is not enough context for users using assistive technologies.
- Anchor to accessibilityRoleaccessibilityRoleAccessibilityRoleDefault: 'generic'
Sets the semantic meaning of the component’s content. When set, the role will be used by assistive technologies to help users navigate the page.
- Anchor to accessibilityVisibilityaccessibilityVisibility'visible' | 'hidden' | 'exclusive'Default: 'visible'
Changes the visibility of the element.
visible: the element is visible to all users.hidden: the element is removed from the accessibility tree but remains visible.exclusive: the element is visually hidden but remains in the accessibility tree.
- Anchor to backgroundbackground'base' | 'subdued' | 'transparent'Default: 'transparent'
Adjust the background of the element.
- Anchor to blockSizeblockSizeMaybeResponsive<SizeUnitsOrAuto>Default: 'auto'
Adjust the block size.
- Anchor to borderborderBorderShorthandDefault: 'none' - equivalent to `none base auto`.
Set the border via the shorthand property.
This can be a size, optionally followed by a color, optionally followed by a style.
If the color is not specified, it will be
base.If the style is not specified, it will be
auto.Values can be overridden by
,, and.- Anchor to borderRadiusborderRadiusMaybeAllValuesShorthandProperty<Extract<BoxProps$1['borderRadius'], 'none' | 'small-100' | 'small' | 'base' | 'large' | 'large-100' | 'max'>>Default: 'none'
Set the radius of the border.
1-to-4-value syntax is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is:
- 4 values:
start-start start-end end-end end-start - 3 values:
start-start (start-end & end-start) start-end - 2 values:
(start-start & end-end) (start-end & end-start)
For example:
small-100means start-start, start-end, end-end and end-start border radii aresmall-100.small-100 nonemeans start-start and end-end border radii aresmall-100, start-end and end-start border radii arenone.small-100 none large-100means start-start border radius issmall-100, start-end border radius isnone, end-end border radius islarge-100and end-start border radius isnone.small-100 none large-100 small-100means start-start border radius issmall-100, start-end border radius isnone, end-end border radius islarge-100and end-start border radius issmall-100.
- 4 values:
- Anchor to borderStyleborderStyleMaybeAllValuesShorthandProperty<BorderStyleKeyword> | ""Default: '' - meaning no override
Set the style of the border.
If set, it takes precedence over the
borderproperty's style.Like CSS, up to 4 values can be specified.
If one value is specified, it applies to all sides.
If two values are specified, they apply to the block sides and inline sides respectively.
If three values are specified, they apply to the block-start, both inline sides, and block-end respectively.
If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
- Anchor to borderWidthborderWidthMaybeAllValuesShorthandProperty<ReducedBorderSizeKeyword> | ''Default: '' - meaning no override
Set the width of the border.
If set, it takes precedence over the
borderproperty's width.Like CSS, up to 4 values can be specified.
If one value is specified, it applies to all sides.
If two values are specified, they apply to the block sides and inline sides respectively.
If three values are specified, they apply to the block-start, both inline sides, and block-end respectively.
If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
- Anchor to displaydisplayMaybeResponsive<"auto" | "none">Default: 'auto'
Sets the outer display type of the component. The outer type sets a component’s participation in flow layout.
auto: the component’s initial value. The actual value depends on the component and context.none: hides the component from display and removes it from the accessibility tree, making it invisible to screen readers.
- string
A unique identifier for the element.
- Anchor to inlineSizeinlineSizeMaybeResponsive<SizeUnitsOrAuto>Default: 'auto'
Adjust the inline size.
- Anchor to maxBlockSizemaxBlockSizeMaybeResponsive<SizeUnitsOrNone>Default: 'none'
Adjust the maximum block size.
- Anchor to maxInlineSizemaxInlineSizeMaybeResponsive<SizeUnitsOrNone>Default: 'none'
Adjust the maximum inline size.
- Anchor to minBlockSizeminBlockSizeMaybeResponsive<SizeUnits>Default: '0'
Adjust the minimum block size.
- Anchor to minInlineSizeminInlineSizeMaybeResponsive<SizeUnits>Default: '0'
Adjust the minimum inline size.
- Anchor to overflowoverflow'hidden' | 'visible'Default: 'visible'
Sets the overflow behavior of the element.
hidden: clips the content when it is larger than the element’s container. The element will not be scrollable and the users will not be able to access the clipped content by dragging or using a scroll wheel on a mouse.visible: the content that extends beyond the element’s container is visible.
- Anchor to paddingpaddingMaybeResponsive<MaybeAllValuesShorthandProperty<PaddingKeyword>>Default: 'none'
Adjust the padding of all edges.
1-to-4-value syntax is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is:
- 4 values:
block-start inline-end block-end inline-start - 3 values:
block-start inline block-end - 2 values:
block inline
For example:
largemeans block-start, inline-end, block-end and inline-start paddings arelarge.large nonemeans block-start and block-end paddings arelarge, inline-start and inline-end paddings arenone.large none largemeans block-start padding islarge, inline-end padding isnone, block-end padding islargeand inline-start padding isnone.large none large smallmeans block-start padding islarge, inline-end padding isnone, block-end padding islargeand inline-start padding issmall.
A padding value of
autowill use the default padding for the closest container that has had its usual padding removed.- 4 values:
- Anchor to paddingBlockpaddingBlockMaybeResponsive<MaybeTwoValuesShorthandProperty<PaddingKeyword> | "">Default: '' - meaning no override
Adjust the block-padding.
large nonemeans block-start padding islarge, block-end padding isnone.
This overrides the block value of
padding.- Anchor to paddingBlockEndpaddingBlockEndMaybeResponsive<PaddingKeyword | "">Default: '' - meaning no override
Adjust the block-end padding.
This overrides the block-end value of
.- Anchor to paddingBlockStartpaddingBlockStartMaybeResponsive<PaddingKeyword | "">Default: '' - meaning no override
Adjust the block-start padding.
This overrides the block-start value of
.- Anchor to paddingInlinepaddingInlineMaybeResponsive<MaybeTwoValuesShorthandProperty<PaddingKeyword> | "">Default: '' - meaning no override
Adjust the inline padding.
large nonemeans inline-start padding islarge, inline-end padding isnone.
This overrides the inline value of
padding.- Anchor to paddingInlineEndpaddingInlineEndMaybeResponsive<PaddingKeyword | "">Default: '' - meaning no override
Adjust the inline-end padding.
This overrides the inline-end value of
.- Anchor to paddingInlineStartpaddingInlineStartMaybeResponsive<PaddingKeyword | "">Default: '' - meaning no override
Adjust the inline-start padding.
This overrides the inline-start value of
.
AccessibilityRole
"main" | "header" | "footer" | "section" | "aside" | "navigation" | "ordered-list" | "list-item" | "list-item-separator" | "unordered-list" | "separator" | "status" | "alert" | "generic" | "presentation" | "none"MaybeResponsive
T | `@container${string}`SizeUnitsOrAuto
SizeUnits | "auto"SizeUnits
`${number}px` | `${number}%` | `0`BorderShorthand
ReducedBorderSizeKeyword | `${ReducedBorderSizeKeyword} ${ReducedColorKeyword}` | `${ReducedBorderSizeKeyword} ${ReducedColorKeyword} ${BorderStyleKeyword}`ReducedBorderSizeKeyword
'large' | 'base' | 'large-100' | 'large-200' | 'none'ReducedColorKeyword
'base'BorderStyleKeyword
"none" | "solid" | "dashed" | "dotted" | "auto"MaybeAllValuesShorthandProperty
T | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`SizeUnitsOrNone
SizeUnits | "none"PaddingKeyword
SizeKeyword | "none"SizeKeyword
"small-500" | "small-400" | "small-300" | "small-200" | "small-100" | "small" | "base" | "large" | "large-100" | "large-200" | "large-300" | "large-400" | "large-500"MaybeTwoValuesShorthandProperty
T | `${T} ${T}`Code
Examples
Code
Default
<s-box background="subdued" borderRadius="base" borderWidth="base" padding="base" > <s-paragraph> Baked fresh to order. Please order 1-2 days before needed due to potential shipping variations. </s-paragraph> </s-box>
Preview

Anchor to best-practicesBest Practices
- Use
s-boxwhen you need a container that preserves the natural size of its contents. s-boxis particularly useful in layout components likes-stackwhere you want to prevent children from stretching to fit.s-boxhas adisplay: blocklayout by default.- Use
s-boxfor simple container needs where you don't need the additional features of more specialized components likes-stack. - Consider using
s-boxwhen you need to apply specific styling or layout properties to a group of elements without affecting their natural dimensions.