TLDR
- New component DtBox handles surface styling:
padding,surface,border,shadow,borderRadius,sizing, simple positioning,overflow, andscrollbar. - Completes the primitive triad: DtBox (container) + DtText (typography) + DtStack (layout).
- Replaces manual composition of CSS utility classes like
class="d-bgc-primary d-bc-default d-baw-100 d-bar-200 d-p-200 d-bs-sm". - All prop values are token-constrained and validated — invalid values produce console warnings, not silent failures.
- Component docs • Storybook
The Primitive Triad
Dialtone's UI primitives now cover three distinct concerns:
- DtBox: what the container is: surface color, border, padding, shadow, sizing, positioning
- DtText: what the content looks like: font family, size, weight, color
- DtStack: how children are arranged: flex direction, gap, alignment
Demo
Each primitive owns its domain. In the example below, DtBox provides the visual container (surface, border, shadow, padding). DtStack arranges the children vertically with consistent gap. DtText renders the typography.
Why DtBox Over CSS Utilities?
Building a custom container previously might look like this:
Six CSS utility classes from six different naming conventions (d-bgc-*, d-bc-*, d-baw-*, d-bar-*, d-p-*, d-bs-*). Each requires knowing the prefix, the token scale, and the exact naming pattern. A wrong prefix (e.g., d-bg-primary instead of d-bgc-primary) silently fails.
With DtBox:
The prop names are self-documenting. The values are validated: pass surface="foo" and you get a console warning instead of silent failure. IDE autocomplete works. The Dialtone MCP server also returns the full prop API in one search, making DtBox easier for AI-assisted development tools to work with.
Prop Tiers
| Tier | Props | Description |
|---|---|---|
| Core | as, padding, surface, borderWidth, borderColor, borderRadius, shadow, overflow, scrollbar | The props you'll use most of the time. |
| Directional | paddingBlock, paddingBlockStart, paddingBlockEnd, paddingInline, paddingInlineStart, paddingInlineEnd, borderWidthBlock, borderWidthBlockStart, borderWidthBlockEnd, borderWidthInline, borderWidthInlineStart, borderWidthInlineEnd | Per-axis/side overrides. Cascade: specific > axis > shorthand. |
| Sizing | blockSize, inlineSize, maxBlockSize, minBlockSize, maxInlineSize, minInlineSize | Layout token scale (--dt-layout-*), including percentages. |
| Positioning | position, inset, insetBlock, insetInline, insetBlockStart, insetBlockEnd, insetInlineStart, insetInlineEnd, zIndex | Token-backed container positioning and semantic stack layers. |
Scrollbar Integration
The scrollbar prop integrates the v-dt-scrollbar directive as a first-class feature.
Composing With the Triad
Here's a more realistic composition showing how the three primitives of DtBox, DtStack, and DtText work together while each handling exactly one concern:
- DtStack handles the arrangement of elements.
- DtBox provides the card surface (
as="aside"for semantics, padding, border, radius). - Nested DtBox instances provide the secondary surfaces.
- DtText handles all typography.
- class="d-fl1" is the utility escape hatch for flex-grow, a property DtBox intentionally doesn't provide.
What DtBox Does NOT Do
- Layout: No
direction,gap,justify, oralign. Use DtStack. - Typography: No
font,size,tone, orweight. Use DtText. - Flex child: No
flexGrow,flexShrink, oralignSelf. Use CSS Utility classes. - Complex positioning: No responsive, calc, arbitrary, or CSS-wide reset offsets. Use CSS Utility classes.
These boundaries are intentional as DtBox is a container primitive, not a general-purpose styled element. The class attribute remains the escape hatch for anything outside its prop surface.
See the full component documentation for all prop values, demos, and usage guidance.
