Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Settings Version Sheet Success Block for React

A thermostat settings page with the sheet that says what a save changed, shown open: three settings from old value to new, the version and its time, a Done button and a Revert to version 13 that redraws the page.

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

Say exactly what a save did with this confirmation sheet for React with Base UI. It opens from the Hallway thermostat page of Dialwise, a thermostat app: the page's header holds an outline View changes Button, and the page itself is drawn under a soft scrim inside a hairline frame with a plus mark on each corner, its slider, its 24-hour night strip and its away switch drawn from the saved values. The Sheet reads "Saved as version 14" over the three settings that changed, each as the old value, an arrow and the new one, the day and time the version was saved, a Shine Button Done and an outline Revert to version 13. Revert redraws the page with version 13's values, and the sheet then reads "Back on version 13" with Restore version 14. For settings pages, admin panels and any save that deserves a receipt.

FAQ

Why is the sheet already open, and what do I keep?

So you can see it without a click. On load the sheet is a copy drawn in place over the page: a native dialog element that isn't modal, so nothing is trapped, hidden or focused and the page around the preview keeps working. View changes opens the real Sheet, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same SheetChanges component and share the block's state. In your app keep the Sheet and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.

What does Revert do, and how do I wire it?

Here it swaps the two typed versions: the page is redrawn from version 13's values, the sheet closes, focus returns to View changes and a polite status message says "Reverted to version 13 in this demo. Nothing was saved." Opening the sheet again shows "Back on version 13" with Restore version 14, which swaps them back. In your app call your API from revert to restore the older version as a new one, and build the two versions from its response.

How are the changes worked out?

By comparing the words each setting shows in the two versions: only the settings whose value differs are listed, and the count ("3 of 3") follows the list. To add a setting, add it to SETTINGS and to readOf, give both versions a value for it and draw it in SettingsDrawing.

Which side does the sheet come from?

From the end of the layout. The catalog's sheet sides are physical, so the block reads the page's direction when you open it and passes left in a right-to-left layout and right otherwise. The trigger is passed to SheetTrigger through render, and the sheet is controlled with open and onOpenChange.

Is it accessible from the keyboard?

Yes. The real sheet is named by its title and described by its sentence, and focus stays inside until it closes; Escape, Done and the close button return focus to View changes. The copy shown on load moves no focus; Escape inside it, Done and its close button close it and put focus on View changes. One polite status message reports a revert or a restore.

How does it look on a phone?

The copy shown on load docks to the foot of the page as a bottom sheet with Done and Revert pinned under the list of changes, and the real sheet keeps the Sheet's own phone layout. The drawn page behind it is shorter and keeps its shapes.

  • Pro

    A confirmation alert dialog shown open over a drawn variables table: three variables saved, listed as added, changed and removed with a glyph and a word each, masked values with a Reveal for typed samples, and Redeploy now or Later.

  • Pro

    A notification settings panel: a channel strip with all-or-nothing checkboxes, a matrix of switches by activity and channel with a locked security email, quiet hours, and a save bar that counts unsaved changes.

  • Pro

    Invite Members Dialog

    Share and invite

    A household calendar's Members page with its invite dialog shown open: one email field that knows the household's domain, so an outside address joins as a guest, the people who already have access, and a Send invite button that adds a pending row.

  • Pro

    Environment Variables Settings

    Domains and delivery

    An environment variables settings panel that shows where each variable is set across Production, Preview and Development, counts what is missing, fills a missing value with Copy from, and previews a pasted .env file before it imports.

  • Pro

    Sync Completed Success

    Integrations and syncs

    A confirmation panel for a finished data sync: a table of records created, updated and skipped for four objects with a segmented bar under each name, a switch for a 15-minute schedule with the next run time, and a Sync now button that adds a second run.

  • Pro

    Asset Uploaded Success

    Saves and updates

    A confirmation panel for an uploaded picture: a greyscale drawing in a frame beside a table of the original and its three smaller copies, with sizes, how much smaller each is worked out from the byte counts and a button that copies each URL.