Box

New

Low-level surface and spacing primitive for building token-constrained containers.

Preview

Usage

DtBox complements DtText (typography) and DtStack (flex layout) to form Dialtone's primitive triad:

  • DtBox: what the container is (surface, border, padding, sizing)
  • DtText: what the content looks like (font, size, color)
  • DtStack: how children are arranged (direction, gap, alignment)

Guidance

  • Use DtBox in place of composing multiple surface utility classes (e.g., d-bgc-*, d-bc-*, d-bar*, d-bs-*, d-p-*).
  • Use the as prop to render semantic HTML elements (section, nav, article, header, etc.) for accessibility.
  • DtBox is a passive container — it does not handle layout (use DtStack) or typography (use DtText).
  • Compose DtBox + DtStack + DtText together for structured UI surface containers.

Do

  • Use DtBox for card surfaces, info panels, content regions, and any container that needs surface styling.
  • Compose with DtStack for layout: <dt-box><dt-stack>...</dt-stack></dt-box>.
  • Use the as prop for semantic HTML: <dt-box as="nav">, <dt-box as="section">.
  • Use class for one-off styling outside DtBox's prop surface (e.g., class="d-ps-sticky").

Don’t

  • Don't use DtBox for flex layout — use DtStack for direction, gap, alignment.
  • Don't use DtBox for typography — use DtText for font, size, tone.
  • Don't use utility classes for properties DtBox already handles (e.g., avoid class="d-bgc-primary" when surface="primary" exists).
  • Don't nest DtBox deeply when a dedicated component (DtCard, DtNotice) better fits the pattern.

Surface

Background surface color mapped to --dt-color-surface-* tokens.

Semantic surfaces

Padding

Spacing token scale values for internal whitespace. The padding cascade resolves specific sides over axis shorthands over the all-sides shorthand.

Directional padding

Override specific sides. The cascade resolves: paddingBlockStart > paddingBlock > padding.

Border

Border width

No visible border until a border-width is set. Uniform width applies to all sides.

Directional border width

Show borders on specific sides only.

Border color

Defaults to 'default' (--dt-color-border-default). Only visible when a border-width is set.

Border radius

Shadow

Sizing

Maps to Dialtone's layout token scale (--dt-layout-*). Supports both fixed values and percentage tokens.

Overflow

Scrollbar

Integrates the v-dt-scrollbar directive. An inner viewport wrapper is inserted automatically, solving the Custom Scrollbar's single-child constraint.

Render as

Use the as prop to render semantic HTML elements for accessibility.

Examples

Card

Composed layout

Accessibility

  • Use the as prop to render appropriate semantic elements — nav for navigation, section for thematic content, article for self-contained content.
  • DtBox does not add any implicit ARIA role. The rendered element's native semantics determine how screen readers interpret it.
  • When using as="nav" or as="section", consider adding aria-label to provide an accessible name for the landmark region.
  • The scrollbar integration preserves native keyboard scrolling behavior.

Vue API

import { DtBox } from '@dialpad/dialtone-vue';

Slots

Name
Type
default

Slot for main content

Props

Name
Default
Type
as
'div'
"div" | "span" | "section" | "article" | "aside" | "main" | "header" | "footer" | "nav" | "ul" | "ol" | "li" | "fieldset" | "form" | "figure"

HTML element to render as.

blockSize
"0" | "1px" | "2px" | "8px" | "25" | "20px" | "24px" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800" | "850" | "900" | "950" | "1000" | "1050" | "1100" | "1150" | "1200" | "1250" | "1300" | "1350" | "1400" | "1450" | "1500" | "1550" | "1600" | "10p" | "20p" | "25p" | "30p" | "33p" | "40p" | "50p" | "60p" | "66p" | "70p" | "75p" | "80p" | "90p" | "95p" | "100p"

Block size (aka height). Maps to --dt-layout-* tokens.

borderColor
'default'
"transparent" | "subtle" | "default" | "moderate" | "bold" | "positive" | "positive-subtle" | "positive-strong" | "warning" | "warning-subtle" | "warning-strong" | "critical" | "critical-subtle" | "critical-strong" | "info" | "info-subtle" | "info-strong" | "focus" | "brand" | "brand-subtle" | "brand-strong"

Border color. Maps to --dt-color-border-* tokens. Defaults to 'default'. Visible when any border-width prop is set.

borderRadius
"0" | "100" | "200" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "pill" | "circle"

Border radius. Maps to --dt-size-radius-* tokens.

borderWidth
"0" | "50" | "100" | "150" | "200" | "300" | "400"

Border width on all sides. Maps to --dt-size-border-* tokens.

borderWidthBlock
"0" | "50" | "100" | "150" | "200" | "300" | "400"

Border width on the block axis (aka top/bottom). Overrides borderWidth for block sides.

borderWidthBlockEnd
"0" | "50" | "100" | "150" | "200" | "300" | "400"

Border width on the block-end side (aka bottom). Overrides borderWidthBlock and borderWidth for block-end.

borderWidthBlockStart
"0" | "50" | "100" | "150" | "200" | "300" | "400"

Border width on the block-start side (aka top). Overrides borderWidthBlock and borderWidth for block-start.

borderWidthInline
"0" | "50" | "100" | "150" | "200" | "300" | "400"

Border width on the inline axis (aka left/right). Overrides borderWidth for inline sides.

borderWidthInlineEnd
"0" | "50" | "100" | "150" | "200" | "300" | "400"

Border width on the inline-end side (aka right). Overrides borderWidthInline and borderWidth for inline-end.

borderWidthInlineStart
"0" | "50" | "100" | "150" | "200" | "300" | "400"

Border width on the inline-start side (aka left). Overrides borderWidthInline and borderWidth for inline-start.

inlineSize
"0" | "1px" | "2px" | "8px" | "25" | "20px" | "24px" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800" | "850" | "900" | "950" | "1000" | "1050" | "1100" | "1150" | "1200" | "1250" | "1300" | "1350" | "1400" | "1450" | "1500" | "1550" | "1600" | "10p" | "20p" | "25p" | "30p" | "33p" | "40p" | "50p" | "60p" | "66p" | "70p" | "75p" | "80p" | "90p" | "95p" | "100p"

Inline size (aka width). Maps to --dt-layout-* tokens.

maxBlockSize
"0" | "1px" | "2px" | "8px" | "25" | "20px" | "24px" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800" | "850" | "900" | "950" | "1000" | "1050" | "1100" | "1150" | "1200" | "1250" | "1300" | "1350" | "1400" | "1450" | "1500" | "1550" | "1600" | "10p" | "20p" | "25p" | "30p" | "33p" | "40p" | "50p" | "60p" | "66p" | "70p" | "75p" | "80p" | "90p" | "95p" | "100p"

Maximum block size. Maps to --dt-layout-* tokens.

maxInlineSize
"0" | "1px" | "2px" | "8px" | "25" | "20px" | "24px" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800" | "850" | "900" | "950" | "1000" | "1050" | "1100" | "1150" | "1200" | "1250" | "1300" | "1350" | "1400" | "1450" | "1500" | "1550" | "1600" | "10p" | "20p" | "25p" | "30p" | "33p" | "40p" | "50p" | "60p" | "66p" | "70p" | "75p" | "80p" | "90p" | "95p" | "100p"

Maximum inline size. Maps to --dt-layout-* tokens.

minBlockSize
"0" | "1px" | "2px" | "8px" | "25" | "20px" | "24px" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800" | "850" | "900" | "950" | "1000" | "1050" | "1100" | "1150" | "1200" | "1250" | "1300" | "1350" | "1400" | "1450" | "1500" | "1550" | "1600" | "10p" | "20p" | "25p" | "30p" | "33p" | "40p" | "50p" | "60p" | "66p" | "70p" | "75p" | "80p" | "90p" | "95p" | "100p"

Minimum block size. Maps to --dt-layout-* tokens.

minInlineSize
"0" | "1px" | "2px" | "8px" | "25" | "20px" | "24px" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800" | "850" | "900" | "950" | "1000" | "1050" | "1100" | "1150" | "1200" | "1250" | "1300" | "1350" | "1400" | "1450" | "1500" | "1550" | "1600" | "10p" | "20p" | "25p" | "30p" | "33p" | "40p" | "50p" | "60p" | "66p" | "70p" | "75p" | "80p" | "90p" | "95p" | "100p"

Minimum inline size. Maps to --dt-layout-* tokens.

overflow
"hidden" | "scroll" | "auto" | "clip" | "visible"

Overflow behavior.

padding
"0" | "1" | "25" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "525" | "550" | "600" | "650" | "700" | "750" | "800"

Padding on all sides. Accepts spacing token scale values.

paddingBlock
"0" | "1" | "25" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "525" | "550" | "600" | "650" | "700" | "750" | "800"

Padding on the block axis (aka top/bottom). Overrides padding for the block axis.

paddingBlockEnd
"0" | "1" | "25" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "525" | "550" | "600" | "650" | "700" | "750" | "800"

Padding on the block-end side (aka bottom). Overrides paddingBlock and padding for block-end.

paddingBlockStart
"0" | "1" | "25" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "525" | "550" | "600" | "650" | "700" | "750" | "800"

Padding on the block-start side (aka top). Overrides paddingBlock and padding for block-start.

paddingInline
"0" | "1" | "25" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "525" | "550" | "600" | "650" | "700" | "750" | "800"

Padding on the inline axis (aka left/right). Overrides padding for the inline axis.

paddingInlineEnd
"0" | "1" | "25" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "525" | "550" | "600" | "650" | "700" | "750" | "800"

Padding on the inline-end side (aka right). Overrides paddingInline and padding for inline-end.

paddingInlineStart
"0" | "1" | "25" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "525" | "550" | "600" | "650" | "700" | "750" | "800"

Padding on the inline-start side (aka left). Overrides paddingInline and padding for inline-start.

scrollbar
"leave" | "scroll" | "move" | "always"

Custom scrollbar via OverlayScrollbars. When set, an inner viewport wrapper (.d-box__scrollbar-content) is inserted automatically.

scrollbarContentClass
''
string|object|array

Additional CSS classes applied to the scrollbar content wrapper element. Only applies when scrollbar prop is set.

shadow
"small" | "medium" | "large" | "extra-large" | "card"

Box shadow. Maps to --dt-shadow-* tokens.

surface
"primary" | "primary-opaque" | "secondary" | "secondary-opaque" | "moderate" | "moderate-opaque" | "bold" | "bold-opaque" | "strong" | "strong-opaque" | "contrast" | "contrast-opaque" | "backdrop" | "overlay" | "brand" | "brand-opaque" | "brand-subtle" | "brand-subtle-opaque" | "brand-strong" | "info" | "info-opaque" | "info-subtle" | "info-subtle-opaque" | "info-strong" | "positive" | "positive-opaque" | "positive-subtle" | "positive-subtle-opaque" | "positive-strong" | "warning" | "warning-opaque" | "warning-subtle" | "warning-subtle-opaque" | "warning-strong" | "critical" | "critical-opaque" | "critical-subtle" | "critical-subtle-opaque" | "critical-strong"

Background surface color. Maps to --dt-color-surface-* tokens.

Classes

Class
Applies to
Description

Box documentation last updated Thursday, June 18, 2026