Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Terms Accept Dialog Block for React

A marketplace sign-up at its last step with the terms shown open: an alert dialog with six sections in a focusable scroll region, a reading bar, and a checkbox that stays off until the end has been reached.

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

Make sure the terms were scrolled to before they were accepted, with this terms dialog for React with Base UI. It opens from the third step of the seller sign-up at Plainmarket, a marketplace for handmade goods: the header holds an outline Review terms Button, and the three-step form is drawn under a soft scrim inside a hairline frame with a plus mark on each corner, its Continue locked. The Alert Dialog names version 3 and its effective date, shows a Progress bar with a "Read 62%" count that follows the furthest point reached, and holds six numbered sections in a scroll region that is named and focusable, so the arrows and Space scroll it. The Checkbox "I have read and accept these terms" stays off until the end has been reached and stays on offer after; Accept and continue, the one Shine Button, turns on once it is ticked and says what is missing if it is pressed early. Decline is outline. For preview the alert is drawn open in place when the page loads; Review terms opens the real Alert Dialog, with the same reading progress. For sign-ups, contracts, licences and policy updates.

FAQ

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

So you can see it without a click. On load the alert is a copy drawn in place over the sign-up: a native dialog element with the alertdialog role that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. Review terms in the header opens the real Alert Dialog, modal, with its focus trap and Escape, and the copy stays closed until a reload. Both show the same TermsFields component and share the block's state, so how far someone read in the copy counts in the real alert. In your app keep the Alert Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.

How does the scroll gate work, and can a keyboard reach the end?

The region is a section with an accessible name and tabIndex={0}, so a keyboard user can focus it and scroll with the arrows, Page Down and Space, and the real alert opens with focus on it. percentOf turns the scroll position into a whole percent, 99 at most until the last pixels are reached, and the block keeps the furthest value, so scrolling back up doesn't take the checkbox away. At 100 the status line says once that the end was reached; it never speaks a percentage on every scroll.

What does Accept and continue check, and what does it do?

It is always on the screen and pressable, never hidden. Pressed before the end it says "Scroll to the end of the terms first" and moves focus to the region; pressed with the box unticked it says to tick the box; otherwise it accepts, closes the alert, unlocks the drawn Continue and says "Terms accepted (version 3)". Nothing is recorded: in your app send the version, the time and the person from the server, never from the page, and keep the alert open with a busy state until it answers. Decline and Escape close the alert and say a seller account needs the terms.

Where do the version and the date come from?

They are typed constants: version 3, effective 1 Sep 2026. The block never reads the clock, so the preview and the gallery card never age. In your app send the version the person saw along with the acceptance, so a later change of the terms can ask again.

Where does focus go, and how does it close?

The real alert is named by its title and described by its sentence, and opens with focus on the terms. Escape and Decline close it and return focus to Review terms; clicking outside does not close it. The terms are the focus target through initialFocus. Because a modal hides the page's own status message from assistive technology, what is said while the real alert is open is also said by a second status inside it.

How does it look on a phone?

The copy shown on load docks to the foot of the page as a bottom sheet, with Decline and Accept and continue pinned side by side and the whole body scrolling when the screen is short. The real alert is as tall as the screen allows, so the terms get the room: the region fills what the title, the checkbox and the buttons leave.

  • Pro

    Cookie Settings Dialog

    Confirm and consent

    A newspaper's cookie preference centre shown open over its front page: four categories with switches and counts, Essential locked on, and for the chosen one a sentence and a table of its actual cookies, then Reject non-essential, Accept all and Save choices.

  • Pro

    Confirm Delete Dialog

    Destructive confirms

    A planner's project list with its delete confirmation shown open: an alert dialog that lists what goes with the project, asks for its name to be typed exactly, and keeps Delete off until it matches.

  • Pro

    Warning Dialog

    Destructive confirms

    A hosted database's Migrations page with its caution shown open: an alert dialog with a drawn freeze track and a checkbox that must be ticked before the destructive Run anyway turns on.

  • Pro

    Success Dialog

    Status and errors

    An invoice page with its payment confirmation shown open: a dialog with a drawn check, a receipt list with a copy button for the reference, and one button that settles the invoice.

  • Pro

    Unsaved Changes Dialog

    Confirm and consent

    An essay editor with its leave prompt shown open: an alert dialog that lists what changed since the last save and offers Save and leave, Discard changes and Keep editing.

  • Pro

    Age-Aware Sign-Up Dialog

    Account and security

    A recipe community page with its sign-up dialog shown open: a rail of promises, name, email, password and date of birth fields, the terms, and a button that changes with the age worked out from the date.