Stack Item 1
Stack Item 2
Stack Item 3
default.tsx
1'use client';23import React from 'react';4import { Stack } from '../../layout/stack';56export function Default() {7 return (8 <Stack9 gap="3"10 align="stretch"11 className="border-border bg-card w-full max-w-md rounded-xl border p-4"12 >13 <div className="bg-primary/20 text-primary border-primary/30 flex h-12 items-center justify-center rounded-lg border font-medium">14 Stack Item 115 </div>16 <div className="bg-secondary/20 text-secondary-foreground border-border flex h-12 items-center justify-center rounded-lg border font-medium">17 Stack Item 218 </div>19 <div className="bg-muted text-muted-foreground border-border flex h-12 items-center justify-center rounded-lg border font-medium">20 Stack Item 321 </div>22 </Stack>23 );24}
Installation
pnpm dlx nachui add stackAnatomy
1import { Stack } from '@/components/ui/stack';
1<Stack gap="3">2 <div>Item 1</div>3 <div>Item 2</div>4</Stack>
API Reference
Stack
| Prop | Type | Default | Description |
|---|---|---|---|
as | React.ElementType | 'div' | The element type to render the component as |
direction | 'column' | 'row' | 'column' | The flex orientation flow |
align | 'start' | 'center' | 'end' | 'baseline' | 'stretch' | 'stretch' | CSS align-items mapping |
justify | 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly' | 'start' | CSS justify-content mapping |
wrap | 'nowrap' | 'wrap' | 'wrap-reverse' | 'nowrap' | CSS flex-wrap mapping |
gap | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '8' | '10' | '12' | '16' | '20' | '24' | '32' | - | Gap spacing between elements |
className | string | - | Custom CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.