# Section Rule

> A line between page sections that runs past the page rails, with a mark on each intersection.

- Category: Structure (Rails, rules and section grids that lay out a whole page.)
- Registry item: `section-rule`
- Live preview with controls: https://fancyborders.vercel.app/docs/components/section-rule

## Installation

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

With the registry namespace: `npx shadcn@latest add @fancyborders/section-rule`.

The CLI also adds what `section-rule` is built on: `frame`.

Files it adds: `components/ui/frame.tsx`, `components/section-rule.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 { PageRails } from "@/components/page-rails";
import { SectionRule } from "@/components/section-rule";

<PageRails>
  <section>Section one</section>
  <SectionRule bleed={32} />
  <section>Section two</section>
</PageRails>
```

## Examples

### Dashes and other marks

A rule takes a dash pattern and any corner mark, or none.

```tsx
import { PageRails } from "@/components/page-rails";
import { SectionRule } from "@/components/section-rule";

export default function RuleStyles() {
  return (
    <div className="w-full overflow-x-clip">
      <PageRails className="mx-auto w-full max-w-xs">
        <p className="p-5 font-mono text-sm">Plus marks</p>
        <SectionRule bleed={32} mark="plus" />
        <p className="p-5 font-mono text-sm">Dashed, no marks</p>
        <SectionRule bleed={32} mark={false} dash={4} gap={4} />
        <p className="p-5 font-mono text-sm">Thicker, in colour</p>
        <SectionRule bleed className="frame-line-2 frame-color-sky-500/60" />
        <p className="p-5 font-mono text-sm">To the page edges</p>
      </PageRails>
    </div>
  );
}
```

## Good to know

- Set bleed to true to run the line a full viewport width each way. The page then needs overflow-x: clip on an ancestor.
- The rule is as tall as the frame's line, so frame-line-2 thickens it. For a band rather than a line, use the hatch divider.

## API reference

### SectionRule

```tsx
import { SectionRule } from "@/components/section-rule";
```

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `bleed` | `boolean \| number \| string` | `false` | How far the line runs past each end. true runs it a full viewport width each way. |
| `mark` | `"bracket" \| "square" \| "plus" \| "dot" \| false` | `"square"` | Mark drawn on each end of the line. |
| `dash` | `number \| string` | `4` | Dash length. Setting dash or gap makes the line dashed. |
| `gap` | `number \| string` | `4` | Space between dashes. |

Also accepts every Frame prop and every div attribute.
