# Stack

Vertical stack with spacing.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any docs URL. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

## Installation

```bash
npx shadcn@latest add @angular-pdfcn/forme/stack
```

To install manually, add the dependencies:

```bash
npm install @formepdf/core @formepdf/shared
```

Then copy these files into your project and update the import paths to match your setup:

- `components/pdf/stack/stack.ts`
- `lib/resolve-color.ts`
- `components/pdf/theme-provider.ts`
- `lib/pdf-renderer.ts`
- `lib/pdf-primitives.ts`
- `lib/render.ts`
- `lib/pdf-themes/professional.ts`
- `lib/pdf-themes/primitives.ts`
- `types/pdf-themes.ts`
- `types/pdf-components.ts`

## Usage

```ts
import { Component } from "@angular/core";

import { PdfDivider } from "@/components/pdf/divider/divider";
import { PdfHeading } from "@/components/pdf/heading/heading";
import { PdfStack } from "@/components/pdf/stack/stack";
import { PdfText } from "@/components/pdf/text/text";
import {
  FormeDocument,
  FormePage,
} from "@/lib/pdf-primitives";

@Component({
  imports: [
    FormeDocument,
    FormePage,
    PdfDivider,
    PdfHeading,
    PdfStack,
    PdfText,
  ],
  template: `
    <forme-document>
      <forme-page size="A4" [margin]="30">
        <pdf-stack gap="md">
          <pdf-heading [level]="2">Section</pdf-heading>
          <pdf-text>First paragraph in the stack.</pdf-text>
          <pdf-text>Second paragraph with consistent spacing.</pdf-text>
          <pdf-divider spacing="lg" />
          <pdf-stack gap="lg">
            <pdf-heading [level]="3">Wider gap</pdf-heading>
            <pdf-text>Content grouped with a larger vertical rhythm.</pdf-text>
          </pdf-stack>
        </pdf-stack>
      </forme-page>
    </forme-document>
  `,
})
export class StackDemo {}
```

## API Reference

### PdfStack

| Input       | Type                                                    | Default      |
| ----------- | ------------------------------------------------------- | ------------ |
| `gap`       | `'none' \| 'sm' \| 'md' \| 'lg' \| 'xl'`                | `'md'`       |
| `direction` | `'vertical' \| 'horizontal'`                            | `'vertical'` |
| `align`     | `'start' \| 'center' \| 'end' \| 'stretch'`             | `'start'`    |
| `justify`   | `'start' \| 'center' \| 'end' \| 'between' \| 'around'` | `'start'`    |
| `wrap`      | `boolean`                                               | `false`      |
| `noWrap`    | `boolean`                                               | `false`      |