MagneticTiles

Tiles lean toward the cursor in 3D. Click one and it opens into a card on a shared-layout spring. Cards.

Open playground

About

MagneticTiles is a React component in the Cards category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { MagneticTiles } from "@ashutoshswamy/smoui" and set tiles, columns, pull among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { MagneticTiles } from "@ashutoshswamy/smoui";

<MagneticTiles
  tiles={[{ id: "wallet", label: "Wallet", icon: <WalletIcon width={28} height={28} />, detail: "Cards and balances." }]}
/>

Props 4

tiles

Tiles.

{ id: string; label: string; icon: ReactNode; detail?: string }[]
columns

Grid columns.

numberdefault 3
pull / tilt

Px moved toward the cursor and degrees of tilt.

numberdefault 12 / 12
onOpenChange

The open tile's id, or null when it closes. The grid behind an open tile is inert and focus returns to the tile on close.

(id: string | null) => void