Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Thumbnail Table Block for React

A media library whose first column is a drawn thumbnail: pressing one opens a dialog with a larger drawing, the file's facts and Previous and Next buttons through all six files, shown open in place.

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

Let people look closer from the table, with this thumbnail table for React with Base UI. A framed stage holds a native table of six files from a studio's media library (a thumbnail with the file's name, its kind, size and dimensions). Each thumbnail is a small greyscale drawing, one subject apiece (a mountain pass, a chair, a chart, a poster, a mark, a potted fern), never a photo, and pressing it opens a Dialog with a larger drawing, the file's facts and Previous and Next buttons that go through the six files and wrap round at the ends. The horizontal arrow keys do the same (the other way in a right-to-left layout), focus stays on the button you pressed, and a polite line in the dialog says where you are in words ("File 3 of 6: q3-revenue.svg"). Closing returns focus to the thumbnail that opened it. On load the dialog is drawn open in place over the table, which waits unseen until it is closed; pressing a thumbnail opens the real, modal one. It's built from Dialog, Badge, Button and Guides, with a CSS entrance only. For media libraries, asset managers and any table of files that people want to see.

FAQ

Why are the thumbnails drawn?

So the block carries no photos. Each is a few paths in a 160 by 120 box, filled in three greys and outlined in the foreground, kept in SCENES. For real files, put an img with alt="" in the same button (its name already says "Preview oak-chair.png") and an img with a real alt in the dialog.

How do Previous, Next and the arrow keys work?

Previous and Next step through the files and wrap round at the ends, so neither is ever disabled and focus stays on the one you pressed. While the dialog is up the horizontal arrow keys do the same; in a right-to-left layout the arrows swap so they still point the way they move. The line in the dialog reads the new position out loud ("File 4 of 6: autumn-fair-poster.png").

What is the dialog doing open on load?

That is the preview's part. On load the dialog is drawn in place as a native non-modal dialog over the table, so nothing is trapped; the table behind it is unseen and unfocusable until you close it with the close button or Escape. Pressing any thumbnail opens the real dialog with the library's focus trap, Escape and focus handling, on the same state. In your app keep only the real Dialog.

Where does focus go when it closes?

To the thumbnail that opened it, even if you stepped to other files meanwhile. The libraries each restore focus a little differently for a dialog with no trigger of its own, so the block moves it after the dialog has gone and checks that it arrived.

How does it look on a phone?

The table drops the Kind and Dimensions columns and folds the kind under each file's name. The dialog docks to the bottom of the stage, the drawing is a little shorter and the facts become one sentence. The buttons stay in a row at the foot.

What stays local?

The six files are typed in ITEMS, with sizes and dates that are examples, and nothing is uploaded, fetched or saved. To wire it, load your files into ITEMS (keep a name, a kind, a size and a date) and swap Scene for your image.

  • Pro

    Row Menu Table

    Select and act

    A drafts table where every row has a three-dot menu named after it, with View, Edit, Duplicate, a Shared with team checkbox item, Archive and a destructive Delete that confirms in an alert dialog, shown open in place.

  • Pro

    Export Table

    Select and act

    A sales table with a search and row checkboxes and an Export dialog that asks which rows (visible, selected or all, with counts), whether to include hidden columns and a file name, then downloads a real CSV, shown open in place.

  • Pro

    Quick Actions Table

    Select and act

    A document table whose rows show Rename, Duplicate and Delete icon buttons on hover or focus, with tooltips that name the document and show the key, and a Delete that becomes a quiet row with Undo.

  • Pro

    Link Cell Table

    Rich cells

    A reading list whose titles are real links: an arrow and a name that says opens in a new tab on links to other sites, plain links inside the app, truncated hosts with the whole address in a title, and a preview card on hover or focus.

  • 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

    Copy Cell Table

    Select and act

    A table of discount codes where each code is a button across its whole cell that copies it to the real clipboard and says Copied for two seconds, with a Copy all in the head and a foot line that counts what was copied.