Skip to content

Tile Expand Panel

A primitive that grows any bento tile into a full panel: the panel opens from the tile's own rectangle while its cover, title and figure fly across to their new places.

ProBento Boxminimal
Category
Animations
Added
2026-09-26
Deps
none
Updated
2026-09-26

This is a viberdy Pro component

The live preview, the props panel and the write-up are open to everyone. The full source, the AI prompt and CLI install are part of Pro.

Preview

Selected work

Five launches, one studio.

Open a project · Esc to close

Props

No runtime dependencies
"use client";

import { createContext, useContext, useId, useLayoutEffect, useRef, useState } from "react";
import type { CSSProperties, ReactNode, RefObject } from "react";

/**
 * TileExpandPanel — a primitive that grows any bento tile into a full panel
 * with shared-element continuity, and shrinks it back.
 *
 * Wrap a grid in <TileExpandGroup>. Each <ExpandTile> has a face (what the
 * tile shows) and a `detail` (what the panel shows). Inside both, mark the
 * pieces that are "the same thing" with <Shared k="…">: a cover image, a
 * title, a figure. When a tile opens, the panel grows out of the tile's own
 * rectangle over the group, and every shared piece FLIES from where it sat
 * in the tile to where it sits in the panel, scaling as it goes; everything
 * else in the panel arrives after it. Closing runs it all backwards and
 * returns focus to the tile.
 *

  // ---------------------------------------------------------------
  // Full source available with a viberdy Pro subscription.
  // https://viberdy.dev/pricing
  // ---------------------------------------------------------------
}
Notes

About this animation

Opening a card usually means a modal that fades in over it, and the thing you clicked disappears. Here the tile becomes the panel. Wrap a grid in TileExpandGroup, give each ExpandTile a face and a detail view, and mark the pieces that are the same thing in both, a cover image, a title, a headline figure, with Shared. Open a tile and the panel grows out of that tile's own rectangle while each shared piece flies from where it sat in the tile to where it sits in the panel, scaling as it goes; the rest of the detail arrives just after. Close it and everything runs back into the tile, and focus returns there. It is measure, invert and play by hand, so it needs no View Transitions support and works inside transform-scaled containers. The demo is an agency's case studies, one tile per project, drawn entirely in code.

Curator’s note

Part of the Bento Box kit, drop 2, phase 5: the kit's motion primitive. Pro because it is a small layout-animation engine: every shared piece is measured, inverted and played between two homes, inside scaled containers too.

Related

Pairs well with

Matched on shared tags and category — the entries most likely to be used alongside this one.

NewPro

A dark bento feature grid that is a live system: tiles update on their own, catch a pointer light, reorder by drag or keyboard, and grow into a detail panel.

bentofeature griddashboard

A search icon that smoothly expands into a full text input on click.

searchinputexpand

A share icon that expands into a row of social options with a copy-link state.

sharebuttonexpand