# Magic Card

- Page: https://jiguang132.com/resources/magic-ui/docs/magic-card
- Resource: Magic UI (https://jiguang132.com/resources/magic-ui.md)
- All guides: https://jiguang132.com/resources/magic-ui/docs.md

Install: `npx shadcn@latest add https://jiguang132.com/r/magic-ui/magic-card.json`

## Use case

Add a pointer-following gradient or orb glow to a card.

## Native props used by the examples

Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.

| Owning component prop | Explanation | Example source |
| --- | --- | --- |
| `MagicCard.gradientColor` (magic-card) | The pointer-following fill color in gradient mode. | `examples/magic-card-demo.tsx` |
| `MagicCard.className` (magic-card) | Classes on this native component; initialize Tailwind and its required CSS first. | `examples/magic-card-demo.tsx`、`examples/magic-card-demo-2.tsx` |
| `MagicCard.children` (magic-card) | Native child content; keep the owning component's text/element constraints. | `examples/magic-card-demo.tsx`、`examples/magic-card-demo-2.tsx` |
| `MagicCard.mode` (magic-card) | The owning component's native mode; consult its own union, not another library's mode. | `examples/magic-card-demo-2.tsx` |
| `MagicCard.glowFrom` (magic-card) | The starting glow color in MagicCard orb mode. | `examples/magic-card-demo-2.tsx` |
| `MagicCard.glowTo` (magic-card) | The ending glow color in MagicCard orb mode. | `examples/magic-card-demo-2.tsx` |
| `AvatarCircles.avatarUrls` (avatar-circles) | Avatar imageUrl/profileUrl pairs. | `examples/magic-card-demo-2.tsx` |

## Interaction and state checks

- Magic Card Demo — `magic-card-demo`
- Magic Card Demo 2 — `magic-card-demo-2`

These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.

## Business integration boundary

mode selects a discriminated union: gradientColor belongs to gradient mode; glowFrom/glowTo belong to orb mode. Do not mix both sets.

## Host and motion setup

Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.


## Available examples

magic-card-demo, magic-card-demo-2

Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.




## 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/magic-card
```

</TabsContent>

<TabsContent value="manual">

<Steps>

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



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

</Steps>

</TabsContent>

</Tabs>

## Examples

### Orb



## Usage

```tsx showLineNumbers
import { MagicCard } from "@/components/ui/magic-card"
```

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

## Props

### MagicCard

| Prop name         | Type                  | Default      | Description                                        |
| ----------------- | --------------------- | ------------ | -------------------------------------------------- |
| `children`        | `React.ReactNode`     | `-`          | The content to be rendered inside the card         |
| `className`       | `string`              | `-`          | Additional CSS classes to apply to the card        |
| `mode`            | `"gradient" \| "orb"` | `"gradient"` | Display mode: gradient or orb effect               |
| `gradientSize`    | `number`              | `200`        | Size of the gradient effect                        |
| `gradientColor`   | `string`              | `#262626`    | Color of the gradient effect                       |
| `gradientOpacity` | `number`              | `0.8`        | Opacity of the gradient effect                     |
| `gradientFrom`    | `string`              | `#9E7AFF`    | Start color of the gradient border                 |
| `gradientTo`      | `string`              | `#FE8BBB`    | End color of the gradient border                   |
| `glowFrom`        | `string`              | `#ee4f27`    | Start color of the orb glow effect (orb mode only) |
| `glowTo`          | `string`              | `#6b21ef`    | End color of the orb glow effect (orb mode only)   |
| `glowAngle`       | `number`              | `90`         | Angle of the orb glow gradient (orb mode only)     |
| `glowSize`        | `number`              | `420`        | Size of the orb glow effect (orb mode only)        |
| `glowBlur`        | `number`              | `60`         | Blur amount of the orb glow effect (orb mode only) |
| `glowOpacity`     | `number`              | `0.9`        | Opacity of the orb glow effect (orb mode only)     |




## Complete example installation

The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.

### Magic Card Demo

```bash
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/magic-card/magic-card-demo.json
```

Default import: `@/components/magicui/examples/magic-card-demo`

Dependencies: `@radix-ui/react-label@2.1.11`, `@radix-ui/react-slot@1.3.0`, `class-variance-authority@0.7.1`, `clsx@2.1.1`, `motion@12.42.2`, `next-themes@0.4.6`, `tailwind-merge@3.6.0`

### Magic Card Demo 2

```bash
npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/magic-card/magic-card-demo-2.json
```

Default import: `@/components/magicui/examples/magic-card-demo2`

Dependencies: `@radix-ui/react-slot@1.3.0`, `class-variance-authority@0.7.1`, `clsx@2.1.1`, `motion@12.42.2`, `next@16.4.0`, `next-themes@0.4.6`, `tailwind-merge@3.6.0`

### Minimal usage and theme

```tsx
import Demo from '@/components/magicui/examples/magic-card-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
  return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}

```

Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.


## Source-backed parameter reference

Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.


```ts
MagicCard(props: MagicCardProps)
```



```ts
interface MagicCardBaseProps {
  children?: React.ReactNode
  className?: string
  gradientSize?: number
  gradientFrom?: string
  gradientTo?: string
}

interface MagicCardGradientProps extends MagicCardBaseProps {
  mode?: "gradient"

  gradientColor?: string
  gradientOpacity?: number

  glowFrom?: never
  glowTo?: never
  glowAngle?: never
  glowSize?: never
  glowBlur?: never
  glowOpacity?: never
}

interface MagicCardOrbProps extends MagicCardBaseProps {
  mode: "orb"

  glowFrom?: string
  glowTo?: string
  glowAngle?: number
  glowSize?: number
  glowBlur?: number
  glowOpacity?: number

  gradientColor?: never
  gradientOpacity?: never
}

type MagicCardProps = MagicCardGradientProps | MagicCardOrbProps
```


### Destructuring defaults in source

Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.


```ts
// MagicCard
gradientSize = 200

// MagicCard
gradientColor = "#262626"

// MagicCard
gradientOpacity = 0.8

// MagicCard
gradientFrom = "#9E7AFF"

// MagicCard
gradientTo = "#FE8BBB"

// MagicCard
mode = "gradient"
```


### Native and external types

External types remain defined by React or native dependencies, not manually expanded into guessed props. The installed version's TypeScript definitions are authoritative.


```ts
React.ReactNode
```

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
