本文へ移動
日本語
「散らばるアイコン」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

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.

向いている場面

  • 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.

向かない場面

  • 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.

使い方

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 /> }))}
    />
  )
}

プロパティ

プロパティ型既定値説明
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>.

アクセシビリティ

  • 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.

モーション

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.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

ScatterGrid.jsxscatter-grid.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

カード
「動く枠線カード」は Pro に含まれます。解除するとプレビューが表示されます。
「ビームボーダー」は Pro に含まれます。解除するとプレビューが表示されます。
「カード詳細とロック」は Pro に含まれます。解除するとプレビューが表示されます。