# Marching Ants

> Dashed rules whose dashes travel around the frame, like a selection rectangle.

- Category: Lines (Line styles for any frame: dashes, native styles and motion.)
- Registry item: `frame` — Marching Ants is a recipe: a few layers of `frame` put together, not an item of its own. Install `frame` and copy the code below.
- Live preview with controls: https://fancyborders.vercel.app/docs/components/marching-ants

## Installation

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

With the registry namespace: `npx shadcn@latest add @fancyborders/frame`.

Files it adds: `components/ui/frame.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 { Frame, FrameCorners, FrameRules } from "@/components/ui/frame";

<Frame className="p-6">
  <FrameRules dash={6} gap={4} march />
  <FrameCorners mark="square" />
  Content
</Frame>
```

## Good to know

- The dashes stand still for people who ask for reduced motion.

## API reference

### FrameRules

```tsx
import { FrameRules } from "@/components/ui/frame";
```

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `sides` | `("top" \| "right" \| "bottom" \| "left")[]` | `all four` | Which sides get a line. |
| `overshoot` | `number \| string \| { x?, y? }` | `0` | How far the lines run past the corners. x extends the horizontal lines, y the vertical ones. |
| `dash` | `number \| string` | `4` | Dash length. Setting dash or gap makes the lines dashed. |
| `gap` | `number \| string` | `4` | Space between dashes. |
| `march` | `boolean \| number` | `false` | Make the dashes travel clockwise. A number is the seconds a dash takes to reach the next one's place; true is 0.6. |
| `offset` | `number \| string` | `0` | Distance from the frame's edge. Positive is outward, negative inward. |
| `color` | `string` | – | Overrides the frame's line colour for this layer. |

Also accepts every div attribute, such as className and style.
