Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Split View Gallery Block for React

An asset-review split: a listbox of eight files with small drawings at the start, the chosen file's preview and details at the end, and a divider you drag or arrow to resize.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A list-and-preview gallery for React with Base UI. A resizable pair sits under the page's top rule. At the start, a listbox of eight assets to review: each row has a small drawing, a name, and its type and size. At the end, the chosen asset's preview at its own ratio (a portrait scan, a wide mock-up, a tall poster, a narrow receipt) and a list of its details: type, dimensions, modified date and reviewer. Up and Down choose in the list, the divider is the resize handle (drag it, or focus it and press the arrow keys) with a + mark where it meets the top rule, and a polite line names the asset for screen readers. Below lg a select replaces the list and the preview sits under it. The assets are drawn in the theme's greys, never real documents. It's built from Guides, Listbox, Native Select and Resizable. For review queues, media libraries and any list where you want to see the thing without leaving the list.

FAQ

Which keys work, and what does a screen reader hear?

Tab goes to the list (a listbox named "Assets"); Up and Down move through the files and choose each one as they go, Home and End jump to the ends. Tab again reaches the divider, a separator named "Resize the list and the preview": the arrow keys move it, Home and End send it to its limits. A polite line announces "Till roll, March, 8 of 8" when the file changes.

How far can the divider move?

The list keeps between 26% and 60% of the width and the preview at least 40%, so neither side disappears. The panels start at 38% and 62% and the library keeps the sizes. Below lg the divider is hidden and the panels stack.

How does the preview keep its shape?

The preview stage has a fixed height from lg and measures itself with a container query: the picture is as large as fits, at its own ratio, whichever side you drag. Nothing is cropped, and the details under it stay the same height, so choosing another file moves nothing.

How do I show real files?

The drawn assets are one small Scene component. Where the code comment says so, replace it with an <img> (object-cover in the list's small square, object-contain in the preview), and add a src to each entry of ASSETS. The row's name, type and size come from the same entry.

How does it fit on a phone?

Below lg the list is replaced by a select (a native one, so the platform's own picker opens), and the preview sits under it in a 288 px stage with the details beneath, two to a row. Nothing scrolls sideways at 320 pixels.

Are the dates computed?

No. Each asset has a fixed modified date written into the data and shown in a time element, so the page reads the same on the server and in the browser, and never goes stale.

  • Pro

    Lightbox Gallery

    Stage and thumbnails

    Nine pictures of a photography studio's year on shared hairlines, a featured frame and a caption under each, where every frame opens one viewer dialog with the whole picture, its credit, Previous and Next, a counter, arrow keys and a swipe.

  • Pro

    Thumbnail Strip Gallery

    Stage and thumbnails

    A viewer for a lighting shop: a framed 4:3 stage with Previous and Next, its caption beside it, and a scrollable strip of twelve thumbnails whose arrow keys step through the pictures.

  • Pro

    Media Library Gallery

    Filter, sort and tabs

    A media manager drawn as a window in a hairline frame: tabs that filter by type, a search field, a List or Grid switch, twelve files with size and upload date, and an Empty state.

  • Pro

    Two drawn headphones sharing one picture box behind a draggable divider, each side shown full size and clipped, with a spec table under it that marks every row where the two differ.

  • Pro

    A resizable split, copy and a framed wall of twelve square swatches: drag the divider to change the wall's width and container queries turn two columns into up to five, with a live readout.

  • Pro

    Split View FAQ

    Navigation

    A master-detail FAQ for a sales CRM: a list of eight questions at the start and the chosen answer in a framed panel at the end, with a Next question button.