Skip to content

@dashforge/tw: <Stack className='…'> destroys internal flex/gap classes via tailwind-merge (G-28) #112

Description

@kensaadi

Symptom

@dashforge/tw <Stack direction="column" gap="3" className="…"> renders as display: block with NO gap and NO flex-direction applied — the internal flex flex-col gap-* classes are lost. The final computed style is display: block; row-gap: normal; flex-direction: row;, children flush.

Verified in browser preview:

  • <Stack direction="column" gap="3"> alone → renders correctly (flex flex-col gap-3)
  • <Stack direction="column" gap="3" className="min-h-0">flex flex-col gap-3 disappear during tailwind-merge

Why this is bad

  • Consumer expects className to be additive (standard React pattern)
  • Silent-fail: no error, no visual hint until you notice children have no gap
  • Forces consumers to swap <Stack> for <div className="flex flex-col gap-2 …"> — defeats the purpose of using the primitive

Discovered while

Refactoring PalettePanel.CategoryContent in the Blueprint Builder V2 shell. Filed in Blueprint's dogfood report as G-28 (severity: medium — silent-fail via tailwind-merge collision).

Workaround applied in Blueprint

Replaced <Stack> with raw <div className="flex flex-col gap-2"> at every collision site.

Acceptance (pick one)

  • Option A — preserve internal classes: fix the tailwind-merge config so flex, flex-col, gap-* are preserved when the consumer's className collides on unrelated utilities
  • Option B — restricted API: forbid free-form className on <Stack> and require slotProps.root.className (consistent with the [1.2.0] Component Defaults System — theme.components + slotProps (Option C) #60 Option C slot pattern)
  • Dev-only assertion: if the final computed display of the Stack root is not flex, console.warn in development with a hint
  • Regression test: <Stack className="min-h-0" direction="column" gap="3"> computed style must be display: flex; flex-direction: column; row-gap: <value>

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