# VStack

A vertical Stack convenience primitive with logical-axis alignment.

`VStack` is Stack with a fixed vertical direction. It adds horizontal and vertical alignment aliases while retaining Stack's complete spacing and sizing API.

```tsx
import { Button, VStack } from "@zentara-co/zenos-ui";

function VStackExample() {
  return (
    <VStack
      hAlign="stretch"
      vAlign="start"
      gap="3"
      className="w-full max-w-sm rounded-xl border border-border bg-background-neutral-card p-4"
    >
      {["Profile", "Security", "Notifications"].map((item, index) => (
        <Button key={item} variant={index === 0 ? "secondary" : "outline"}>
          {item}
        </Button>
      ))}
    </VStack>
  );
}
```

## Import

```tsx
import { VStack } from "@zentara-co/zenos-ui";
```

## Logical alignment

`hAlign` aligns children horizontally and maps to Stack's `align`. `vAlign` distributes children vertically and maps to Stack's `justify`.

```tsx
import { Badge, Grid, VStack } from "@zentara-co/zenos-ui";

function VStackAlignmentExample() {
  return (
    <Grid columns={{ base: 1, md: 3 }} gap="4" className="w-full">
      {(["start", "center", "end"] as const).map((hAlign) => (
        <VStack
          key={hAlign}
          hAlign={hAlign}
          vAlign="between"
          gap="2"
          className="min-h-40 rounded-xl border border-border bg-background-neutral-card p-3"
        >
          <Badge>{hAlign}</Badge>
          <Badge variant="default" color="information">
            Bottom
          </Badge>
        </VStack>
      ))}
    </Grid>
  );
}
```

The shared `align` and `justify` props take precedence over aliases when both are supplied. VStack also supports responsive gap, wrapping, padding, size constraints, scrolling, polymorphism, and native props.

Use VStack when fixed vertical intent improves readability. Use Stack when direction changes responsively.

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | ElementType | div | Rendered semantic element. |
| hAlign | Responsive<Align> | — | Horizontal alignment. |
| vAlign | Responsive<Justify> | — | Vertical distribution. |
| gap | Responsive<Spacing> | 4 | Space between children. |
| wrap | Responsive<boolean \| FlexWrap> | false | Wrapping behavior. |
| shared Stack props | padding*, size constraints, isScrollable | — | VStack supports Stack spacing, sizing, scrolling, and native props. |
| native props | React.HTMLAttributes<HTMLElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

VStack changes layout only. Render lists, navigation, sections, and other structures through `as` when those semantics apply, and preserve a logical source order.

Source: https://zenos-ui.pages.dev/layout/v-stack/