shadcn.io is not affiliated with official shadcn/ui
Expandable Tile Grid Gallery Block for React
Twelve drawn potted plants on shared hairlines where choosing one grows its tile to two cells wide and two tall while the others flow around it, one open at a time, with Escape or a button to put it back and a grid that never changes height.
Installation
Overview
A grow-in-place grid for React with Base UI. A start-aligned header sits over twelve drawn potted plants (a snake plant, a cactus, a fern, a rubber plant, a succulent, a trailing plant, in different pots) on shared hairlines that run rail to rail: four across from sm, three on a phone. Choose a plant and its tile grows to two cells wide and two tall, showing its light, water and height, while the others flow around it with grid-auto-flow: dense. One plant is open at a time, and choosing it again, the Put it back button or Escape returns it. A legend cell fills the last row while every plant is small and shrinks to a one-cell button beside the open tile, so the grid fills the same rows either way and the page never moves. The plants are drawn in the theme's greys. It's built from Guides, Button and Kbd. For catalogues, menus and any set where one item at a time deserves room.
FAQ
How does the grid keep its height?
Twelve plants plus a legend cell fill four rows of four (five rows of three on a phone). Open, the big plant takes four cells, so three plants' worth of room has to come from somewhere: the legend gives up all but one cell on desktop, or all of it on a phone, and the grid still fills the same rows. The open tile is placed by its own position in reading order, pushed in so a two-by-two always fits.
Does the reading order change?
No. The DOM order never changes, only the grid placement, so a screen reader and the Tab order follow the same list. Each plant is a button with aria-pressed, and a polite line says which plant is open.
Which keys work?
Tab visits the plants, Enter or Space grows or restores one, and Escape restores the open one while focus is inside the block. Put it back is a normal button.
Related
- Pro
Re-lead Mosaic Gallery
Masonry and mosaicA dense mosaic of nine drawn quilt patterns on shared hairlines, eight squares and one lead two cells wide and two tall, with a Lead control that moves the big square while the rest reflow.
- Pro
Inline Expansion Thumbnail Grid
Hairline gridsSixteen drawn thumbnails on shared hairlines, eight across, where choosing one opens a preview band straight under its row with the whole picture, its source, Previous, Next and Close, without changing the block's height.
- Pro
Featured Hero Gallery
Masonry and mosaicA boat-charter gallery on one hairline grid: a featured picture two cells wide and tall beside four small ones, and choosing a small picture swaps it with the featured one in place.
- Pro
Sortable Masonry Gallery
Masonry and mosaicA masonry wall of twelve drawn pictures of mixed ratio in CSS columns, framed with + marks on its corners, with an Order control (Newest or Oldest) that re-sorts them.
- Pro
Paginated Minimal Grid Gallery
Hairline gridsA quiet grid of twenty-four drawn concrete-architecture plates, eight to a page on shared hairlines, with a title and year that appear on hover and focus and the catalog pagination in a band that ends the block.
- Pro
Card Stack Gallery
Walls and tablesA pile of five drawn risograph prints on a framed table top: send the top one to the back, or spread the pile into a row and gather it again, with a list that says the order.