WebberUI

Focus Cards

A card grid effect where hovering focuses one card while the rest blur and fade out.

When the mouse enters any card, that card scales up slightly and stays sharp while the others blur, shrink, and fade out together, concentrating attention on the one at hand.

Loading preview…
npx shadcn@latest add https://webberui.com/r/focus-cards.json

Playground

Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.

8
0.96
1.02
0.6
260
<FocusCards />

Installation

npx shadcn@latest add https://webberui.com/r/focus-cards.json

Or, once registries are configured in components.json, install it as @webberui/focus-cards.

Usage

import { FocusCards } from "@/components/ui/focus-cards";

const cards = [
  {
    title: "Aurora",
    description: "A cool-toned aurora gradient background",
    background: "linear-gradient(135deg, #22d3ee 0%, #6366f1 100%)",
  },
  // ...
];

<FocusCards cards={cards} />;

Each card renders its backdrop through CSS background (a gradient or a flat color both work), with no dependency on external images. Omit background and a built-in gradient is applied cyclically by index.

Props

PropTypeDefaultDescription
cardsFocusCard[]List of cards; see the type below
blurnumber8Blur strength of unfocused cards (px)
scalenumber0.96Scale of unfocused cards
focusScalenumber1.02Scale of the focused card
dimnumber0.6Opacity of unfocused cards
heightnumber260Card height (px)
classNamestringForwarded to the outer grid container

The FocusCard type

FieldTypeDescription
titlestringCard title
descriptionstringSubtitle, fading in on focus (optional)
backgroundstringAny CSS background value used as the backdrop (optional)

Accessibility

  • Every card can be focused with the keyboard, and focus triggers the same focusing effect as hover
  • When the user has "reduce motion" enabled at the system level, the cards stay static with no blur or scaling
  • Cards carry role="group" and an aria-label, and the darkening gradient along the bottom is decorative only (aria-hidden)

On this page