Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

App Rating Dialog Block for React

A water tracker's Today screen with its rating drawer shown open over a drawn phone: five stars with a word each, then a branch, where four or five stars offers the store and one to three asks what could be better, with topics and a note.

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

Ask for a rating at the moment it is most likely to be a good one, with this rating drawer for React with Base UI. It opens from the Today screen of Sipmark, a water-intake tracker: the header holds an outline Rate Button, and the phone it asks from is drawn under a soft scrim inside a hairline frame with a plus mark on each corner, with a water ring, a row of glasses and a card. The Drawer rises from the bottom with a grabber and holds a Rating of five stars, each named in words, and the answer branches. Four or five stars says glad and offers the store; one to three asks what could be better with a Toggle Group of topics and a Textarea. The branch's one Shine Button is Rate on the store or Send feedback, and Not now snoozes: the drawn card says it will ask again later. For preview the drawer is drawn open in place at the foot of the phone when the page loads; the header button opens the real Drawer, with the same stars and the same answers. For mobile-style apps, post-purchase prompts and any product that earns a rating before it asks for one.

FAQ

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

So you can see it without a click. On load the drawer is a copy drawn in place at the foot of the drawn phone: a native dialog element that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The Rate button in the header opens the real Drawer, modal, with its grabber and swipe to close, Escape, and focus return, and the copy stays closed until a reload. Both show the same RateFields component and share the block's state, so a rating tapped in the copy is there in the real one. In your app keep the Drawer and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.

How does the answer branch?

branchOf reads the stars: four or five is glad, one to three is better, none is the starting hint. The three panels sit in one grid cell and the two that are not shown are inert and invisible, so the drawer never changes height as the branch changes, and what was typed in the feedback panel stays if someone taps another star and back. Change the threshold in branchOf if your bar for asking for a store rating is higher.

What do the buttons do, and how do I wire them up?

Here Rate on the store and Send feedback only change local state: the drawn card says the rating was thanked or the feedback kept, and a polite status message says that nothing opened and nothing was sent. Not now sets the card to Asking again later. In your app open the store's own review prompt or listing from submit for the glad branch, post the stars, topics and note to your server for the other, and store when you last asked, so Not now means a week and a rating means never again.

How do the stars read for a screen reader?

The rating is a group named by a hidden legend, and each star is named in words ("4 of 5, Great"), so a number alone is never the whole message. The arrow keys move between stars and the word under them is a polite live region inside the drawer, so it is read out in the modal too. The stars are the foreground colour and are never the only sign: the word is always there, and "Choose 1 to 5 stars" before a choice.

Is it accessible from the keyboard?

Yes. The real drawer is named by its title and described by its sentence, focus stays inside until it closes, and Escape and Not now return focus to Rate Sipmark. The trigger is passed to DrawerTrigger through render, and the drawer is controlled with open and onOpenChange; React Aria's drawer is the same one Base UI uses. The copy shown on load moves no focus; Escape inside it and Not now close it and put focus on Rate Sipmark.

How does it look on a phone?

The copy shown on load docks to the foot of the frame at the phone's width, and on a phone it runs edge to edge, with its actions pinned at the bottom and Rate on the store or Send feedback above Not now, while the stars and the branch scroll above them. The real drawer is the Drawer's own bottom sheet, which is what a phone gets anyway.

  • Pro

    Feedback Form Dialog

    Drawers and popovers

    A documentation page with a feedback card docked to its end and shown open: a kind, a message of up to 400 characters with a count, the page it is about, and an optional email that turns on when you let the team reply.

  • Pro

    Feedback Rating Dialog

    Feedback and reports

    A help desk's ended chat with a one-tap satisfaction dialog shown open: five drawn faces from very bad to great that record the score at once, then an optional comment with a question that fits the score.

  • Pro

    Feature Request Dialog

    Feedback and reports

    A public roadmap with a request dialog shown open: the title finds similar requests as you type, each with a vote toggle and its count, voting instead closes the dialog, and a new request lands on top of the board's Considering lane.

  • Pro

    Review Submit Dialog

    Feedback and reports

    A tea shop's product listing with a review dialog shown open: three star ratings that roll into one overall, how it was brewed, a title, a review with a length bar, writing tips and a buy-again choice.

  • Pro

    Mood Check Dialog

    Feedback and reports

    A mood journal's home with a check-in dialog shown open: five faces from Rough to Great, tags for what is behind the mood, an optional note of 200 characters, and a week strip that fills in today's cell.

  • Pro

    Audio Player Dialog

    Drawers and popovers

    An ambient-sound library's page with its mini player shown open over it: a floating panel with the track, a seek slider and its time, Previous, Play and Next, and a volume slider with mute. It isn't modal, so the page stays usable, and nothing really plays.