Ir al contenido
Español
Cuadrícula dispersa viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

Cells never move; only the icon tiles inside them are transformed, so the layout never changes. When the pointer enters the card, the component reads the cell centres once and sends every icon outward from the middle of the grid, leaning away from the pointer and bent by its own swerve, and further the closer it is to the pointer (up to 1.25×); each also has its own spin (40–150°, either way), scale and a delay of up to 50ms. Flights are eased in against the room they have, so the icons spread sideways to just inside the card but only a few pixels above and below the grid, and the title and text stay readable. While the pointer moves it re-aims after every 14px, so the icons keep drifting away. Leaving takes a 560ms ease-out; coming home takes 1s on a spring written as linear() from a damped spring (16% overshoot), with the token overshoot curve where linear() is not supported. While they are away, dashed sockets show where each belongs, and the flying tiles lift onto the surface with a shadow.

Úsalo para

  • Feature cards on a landing page: what a plan or kit includes.
  • Integration or tool overviews where a playful moment invites a closer look.
  • Empty states and onboarding cards that should feel alive.

Busca otra opción cuando

  • Grids where each icon is its own action (an app launcher, a toolbar): the icons run away from the pointer.
  • Dense dashboards: several moving cards at once become noise.
  • Icons that must be read precisely, such as status indicators.

Uso

import { ScatterGrid } from './ScatterGrid.jsx'

export function KitCard({ tools }) {
  return (
    <ScatterGrid
      title="Your trip kit"
      description="Tickets, stays, maps and phrases, all saved for offline use."
      items={tools.map((tool) => ({ key: tool.id, label: tool.name, icon: <tool.Icon /> }))}
    />
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
items{ key?: string | number, label: string, icon: ReactNode }[]—The icons, in reading order. Labels are read out as one list; icons are drawn at 22px, usually inline SVG using currentColor.
columnsnumber3Number of columns in the grid.
titleReactNode—The card's title, above the grid.
descriptionReactNode—A line or two under the grid.
spreadnumber1Multiplies how far the icons fly.
scatteredboolean—Controls the state from outside, for example to burst the icons when the card scrolls into view.
onScatterChange(scattered: boolean) => void—Called when hover, a tap or the keyboard asks to change the state.
labels{ group: (names: string[]) => string }—Writes the grid's accessible name from the item labels; the default is “Includes …”.
...restHTMLAttributes<HTMLDivElement>—Other attributes go to the card's root <div>.

Accesibilidad

  • The grid is one button named from the item labels (labels.group), with aria-pressed showing whether the icons are scattered; the icons themselves are hidden from screen readers.
  • Enter or Space toggles the burst from the keyboard, and the focus ring is visible; moving focus away gathers the icons again.
  • On touch a tap on the grid toggles it, bursting from where the finger landed.
  • Reduced motion keeps every icon in its cell and only lifts the tiles, with no flight, spin or spring.

Movimiento

Burst: 560ms cubic-bezier(0.16, 1, 0.3, 1), each icon up to 50ms late. Return: 1000ms spring (16% overshoot). Sockets and lift: 160–240ms.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

ScatterGrid.jsxscatter-grid.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Tarjetas
Tarjeta con borde animado viene con Pro. La vista previa aparece al desbloquearlo.
Borde con haz de luz viene con Pro. La vista previa aparece al desbloquearlo.
Tarjeta con hoja de datos viene con Pro. La vista previa aparece al desbloquearlo.