本文へ移動
日本語

仕組み

The root is an inline-size container, so columns follow the space the grid really has: four from 640px, two from 360px, one below. grid-auto-flow: dense backfills holes when spans do not line up. On two columns a large tile becomes 2×1; on one column all tiles are 1×1 and stack in source order, which is also the reading and tab order.

向いている場面

  • A feature overview on a landing or pricing page.
  • A dashboard home with a few unequal widgets.

向かない場面

  • Long, uniform collections: use a list or a masonry grid.
  • Content whose order matters more than its emphasis: dense packing can move small tiles up.

使い方

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

const features = [
  { id: 'plan', span: 'large', eyebrow: 'Planning', title: 'Boards that stay tidy', description: 'Drag work between stages.', visual: <BoardArt /> },
  { id: 'sync', span: 'small', title: 'Live in every tab', visual: <SyncArt /> },
  { id: 'privacy', span: 'small', title: 'Private by default' },
  { id: 'report', span: 'wide', title: 'Weekly focus report', href: '/reports' },
]

export function Features() {
  return <BentoGrid items={features} gap={12} />
}

プロパティ

プロパティ型既定値説明
items{ id?, span?, eyebrow?, title, description?, visual?, tone?, href?, onClick? }[]—The tiles. span is 'small' (1×1), 'wide' (2×1), 'tall' (1×2) or 'large' (2×2); tone 'accent' or 'ink' changes the fill. With href or onClick the tile is a link or button.
gapnumber12Space between tiles in px.
rowHeightnumber152Minimum row height in px; rows grow to fit their content.
spotlightbooleantrueA soft accent glow that follows the pointer on hover.
...restHTMLAttributes<HTMLDivElement>—Passed to the root, which is the size container.

アクセシビリティ

  • The grid is a list (ul / li), so screen readers announce the number of tiles.
  • Tiles with href render as links and with onClick as buttons, with a 4px accent focus ring; others are plain content.
  • Dense packing changes only the visual position; keep the source order meaningful.
  • Reduced motion replaces the staggered rise with a 200ms fade and removes the hover lift.

モーション

Tiles rise 12px from scale 0.98 over 560ms ease-out, 50ms apart. Interactive tiles lift 2px with a deeper shadow in 260ms; the spotlight fades in over 320ms.

プロジェクトに追加

プロンプトを Codex または Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込む内容を示したうえで、既存のコンポーネントの隣に追加します。

BentoGrid.jsxbento-grid.csstokens.cssREADME.md

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

リスト
「アーチ型カルーセル」は Pro に含まれます。解除するとプレビューが表示されます。
「円柱カルーセル」は Pro に含まれます。解除するとプレビューが表示されます。
「カード束リスト」は Pro に含まれます。解除するとプレビューが表示されます。