Big Bang Grid

ProTransitionsShowcase & Mediapowered by @vectorvesper/motion

A grid that changes with a bang. When you filter it, the cards that leave fall into an unseen hole in its middle, the new ones burst out of it to their places, and the cards that stay slide over. Every card stays a real element, so links, focus and screen readers work as usual.

Big Bang Grid
Preview of Big Bang Grid

Included with membership

Members install Big Bang Grid with one command and get the full source, the usage code and the Framer remix, licensed for client work. One membership covers the whole library and the CLI.

When to use it

Any grid people filter, sort or page through: a work index, a shop's products, a team page, search results. It wraps the grid you already have, so the cards keep their own markup and styles.

  • Give every card a key of its own, such as its id. The key is how the grid tells a card that stays from one that leaves.
  • Lay the grid out with className, as a CSS grid or a wrapping flex row. The cards keep whatever layout you give them.
  • Give images in the cards a size, with a width and an aspect ratio, so each card has its final size before its image loads.
  • Serve card images at about the size they are shown. Every card that bursts out is drawn afresh, and full-size photos make that slow on a phone.

Avoid:

  • Do not use the array index as the key. Every card would seem to stay, so none would fall in or burst out.
  • Do not put a transform or a transition on itemClassName. The grid moves that box with transform and opacity while the cards change.

Props

A grid that changes with a bang. When the cards in it change, the ones that leave fall into an unseen hole, spiralling in as they go, and the new ones burst out of it, fly past their places and settle. Cards that stay slide over to their new cells. The hole sits in the middle of the part of the grid on screen, so the whole change happens in view.

<BigBangGrid />

The grid. Each card is wrapped in a box, and only those boxes move, only while the cards change.

PropTypeDefaultDescription
children*React.ReactNode—The cards, each with its own key. Pass a different set to filter the grid.
classNamestring—On the grid itself: set its columns and gaps here, as a CSS grid or flex row.
styleReact.CSSProperties—Inline styles on the grid.
itemClassNamestring—On the box round each card, which is what sits in each cell.
Visitors who prefer reduced motion see the new cards straight away. Nothing falls, bursts or slides.
Only transform and opacity change, and only while cards are moving. Every card is measured once just before a change and once after it, so the page is laid out once for the whole move. Between changes it does no work.
Every card stays a real element, so links, focus and screen readers work as usual. A card on its way out leaves the tab order and is hidden from screen readers as soon as it starts to fall.
Client component. The server renders the grid and its cards as they are.
Back to all components