Skip to content

@dashforge/tw: <Stack gap='md'> silently renders as 0 — token values not accepted (G-27) #111

Description

@kensaadi

Symptom

@dashforge/tw <Stack> accepts a gap prop typed as string. At runtime, only NUMERIC values from a fixed set are honored: "0" | "0.5" | "1" | "2" | "3" | "4" | "6" | "8" | "12" | "16" | "24". Passing size tokens (gap="xs", "sm", "md", "lg", "xl") is silently ignored — TS accepts the string, runtime falls back to 0, and no warning is emitted.

Why this is bad

  • Consumers coming from MUI (spacing="md") or any design system that speaks size tokens will make this mistake constantly
  • Zero signal: TS is happy, no runtime error, no console warning — layout just looks broken
  • Cost Blueprint hours to notice: children were rendered flush with no visible reason

Repro

<Stack direction="column" gap="md">
  <Chip>a</Chip>
  <Chip>b</Chip>
</Stack>

Expected: children separated. Actual: rowGap: normal, children flush.

Discovered while

Refactoring the Blueprint Builder V2 shell. Filed in Blueprint's dogfood report as G-27 (severity: medium — silent-fail DX bug).

Workaround applied in Blueprint

Replaced all gap="xs|sm|md|lg|xl" with numeric equivalents ("2", "3", "4", "6", "8").

Acceptance (pick one)

  • Option A — strict types: tighten the prop TS union to the exact literal set of numeric values; unknown strings become a compile error
  • Option B — accept both scales: map size tokens ("xs" | "sm" | "md" | "lg" | "xl") to numeric equivalents at runtime, keep the numeric scale as-is (backward compat)
  • Minimum: dev-mode console.warn when an unknown gap value is passed (works alongside either A or B)
  • Consider renaming gapspace to disambiguate from flex gap semantics (documents-only; would be a breaking change requiring a migration note)
  • MDX docs page in dashforge-docs-lab lists the accepted values explicitly

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage:twAffects @dashforge/tw package

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions