Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

1.7 KB
Raw Blame
---
title: Retro Grid
date: 2023-11-23
description: An animated scrolling retro grid effect
author: dillionverma
published: true
video: https://cdn.magicui.design/retro-grid.mp4
---

<ComponentPreview name="retro-grid-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
  <TabsTrigger value="cli">CLI</TabsTrigger>
  <TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">

```bash
npx shadcn@latest add @magicui/retro-grid
```

</TabsContent>

<TabsContent value="manual">

<Steps>

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="retro-grid" />

<Step>Update the import paths to match your project setup.</Step>

<Step>No additional CSS is required.</Step>

</Steps>

</TabsContent>

</Tabs>

## Usage

```tsx showLineNumbers
import { RetroGrid } from "@/components/ui/retro-grid"
```

```tsx showLineNumbers
<div className="relative h-[500px] w-full overflow-hidden">
  <RetroGrid />
</div>
```

## Props

| Prop             | Type     | Default  | Description                                   |
| ---------------- | -------- | -------- | --------------------------------------------- |
| `className`      | `string` | `-`      | Additional CSS classes for the grid container |
| `angle`          | `number` | `65`     | Rotation angle of the grid in degrees         |
| `cellSize`       | `number` | `60`     | Grid cell size in pixels                      |
| `opacity`        | `number` | `0.5`    | Grid opacity value between 0 and 1            |
| `lightLineColor` | `string` | `"gray"` | Grid line color in light mode                 |
| `darkLineColor`  | `string` | `"gray"` | Grid line color in dark mode                  |