# Hatch Divider

> A hatched band between two lines for separating page sections, with marks where it meets the page rails.

- Category: Frames (Structural frames: brackets, rails, marks and hatching.)
- Registry item: `hatch-divider`
- Live preview with controls: https://fancyborders.vercel.app/docs/components/hatch-divider

## Installation

```bash
npx shadcn@latest add https://fancyborders.vercel.app/r/hatch-divider.json
```

With the registry namespace: `npx shadcn@latest add @fancyborders/hatch-divider`.

The CLI also adds what `hatch-divider` is built on: `frame`.

Files it adds: `components/ui/frame.tsx`, `components/hatch-divider.tsx`, and its CSS goes into the global stylesheet after the Tailwind import.

## Usage

The code for the preview at its default settings:

```tsx
import { HatchDivider } from "@/components/hatch-divider";

<HatchDivider />
```

## Examples

### Between page rails

In a column that draws its own side rails, the marks land on the intersections. This site's pages are built this way.

```tsx
import { HatchDivider } from "@/components/hatch-divider";
import { Frame, FrameRules } from "@/components/ui/frame";

export default function DividerRails() {
  return (
    <div className="w-full overflow-x-clip">
      <Frame className="mx-auto w-full max-w-xs">
        <FrameRules sides={["left", "right"]} />
        <p className="p-5 font-mono text-sm">Section one</p>
        <HatchDivider bleed={32} />
        <p className="p-5 font-mono text-sm">Section two</p>
        <HatchDivider bleed={32} mark="plus" className="h-3" />
        <p className="p-5 font-mono text-sm">Section three</p>
      </Frame>
    </div>
  );
}
```

## Good to know

- Set bleed to true to run the lines a full viewport width each way. The page then needs overflow-x: clip on an ancestor.

## API reference

### HatchDivider

```tsx
import { HatchDivider } from "@/components/hatch-divider";
```

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `bleed` | `boolean \| number \| string` | `false` | How far the top and bottom lines run past the band. true runs them a full viewport width each way. |
| `mark` | `"bracket" \| "square" \| "plus" \| "dot" \| false` | `"square"` | Mark drawn where the band's lines meet its sides. |

Also accepts every Frame prop and every div attribute. Set its height with a class such as h-5.
