# Magnetic Card

> Leans toward the pointer; its contents travel further.

Feels like a pane of glass with something behind it. For grids of links and products.

- Family: Cards
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/magnetic-card/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add magnetic-card
```

It installs to `components/galactrex/magnetic-card.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { MagneticCard } from "@/components/galactrex/magnetic-card";

<MagneticCard href="/apps/beforeedit/">…</MagneticCard>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | Content. |
| `strength` | `number` | `12` | Largest pull in px. |
| `href` | `string` | — | Makes the whole card one link. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Link card.** With href.

## Accessibility

- A link with a focus ring when it has href.

## Motion

- Spring follow through motion values.
- Still on touch, keyboard-only and reduced motion.
