Skip to content

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

2.4 KB
Raw Blame
---
title: Neon Gradient Card
date: 2024-05-26
description: A beautiful neon card effect
author: Draxx0
published: true
---

<ComponentPreview name="neon-gradient-card-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/neon-gradient-card
```

</TabsContent>

<TabsContent value="manual">

<Steps>

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

<ComponentSource name="neon-gradient-card" />

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

<Step>Add the required CSS animations</Step>

Add the following animations to your global CSS file .

```css title="app/globals.css" showLineNumbers {2-3, 5-12}
@theme inline {
  --animate-background-position-spin: background-position-spin 3000ms infinite
    alternate;

  @keyframes background-position-spin {
    0% {
      background-position: top center;
    }
    100% {
      background-position: bottom center;
    }
  }
}
```

</Steps>

</TabsContent>

</Tabs>

## Usage

```tsx showLineNumbers
import { NeonGradientCard } from "@/components/ui/neon-gradient-card"
```

```tsx showLineNumbers
<NeonGradientCard>
  <div className="p-4">
    <p>Hello</p>
    <span>Hover me</span>
  </div>
</NeonGradientCard>
```

## Props

| Prop           | Type        | Default                                             | Description                                   |
| -------------- | ----------- | --------------------------------------------------- | --------------------------------------------- |
| `className`    | `string`    | `-`                                                 | The class name to be applied to the component |
| `children`     | `ReactNode` | `-`                                                 | Children elements                             |
| `borderSize`   | `number`    | `5`                                                 | The size of the border                        |
| `borderRadius` | `number`    | `20`                                                | The size of the radius                        |
| `neonColors`   | `object`    | `{ firstColor: "#ff00aa", secondColor: "#00FFF1" }` | The colors of the neon gradient               |

## Credits

- Credit to [@Unleashed-Design](https://unleashed-design.de/)