Stack

Vertical stack layout primitive that arranges children in a flex column with a gap prop from 1 to 8 on a 4px scale. Accepts all normal div props in React.

src/registry/ui/stack.tsx/r/stack.json

Installation#

bash
npx shadcn@latest add @minidev/stack

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/stack.json

Usage#

tsx
import { Stack } from "@/components/ui/stack"

export function Example() {
  return (
    <Stack gap={2}>
      <div className="h-8 rounded-lg bg-sunken" />
      <div className="h-8 rounded-lg bg-sunken" />
    </Stack>
  )
}

API reference#

Stack props
PropTypeDefault
gap1 | 2 | 3 | 4 | 5 | 6 | 83

Also accepts every prop of <div>, passed through to the root element.

Examples#

All layout components

Learn more