shadcn.io is not affiliated with official shadcn/ui
Feedback Form Dialog Block for React
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.
Installation
Overview
Collect a note without taking the reader away from the page, with this feedback card for React with Base UI. It belongs to a page of the Nudgeboard docs: the header holds an outline Feedback Button, and the page itself, a tree of pages, an article and an outline, is drawn inside a hairline frame with a plus mark on each corner, with a "Feedback" pill at its foot. The card is not modal, so the page stays readable beside it. A single-choice Toggle Group sets the kind, idea, problem or praise; a Badge says which page the note is about; a Textarea takes up to 400 characters and shows the count; a Checkbox lets the team reply, which turns on an email Input. Send feedback is the only Shine Button. Sending closes the card and the drawn pill reads "Thanks". For preview the card is drawn open in place when the page loads, docked above the pill with no scrim; the header button opens the real card as a non-modal Popover, with the same fields and the same state.
FAQ
Why is the card already open, and what do I keep?
So you can see it without a click. On load the card is a copy drawn in place at the foot of the page: a native dialog element that isn't modal and has no scrim, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The Feedback button opens the real card as a Popover that is not modal, with Escape and focus return, and the copy stays closed until a reload. Both show the same NoteFields component and share the block's state, so a note started in the copy is there in the real one. In your app keep the card fixed at the page's foot, non-modal, and drop the copy: the "in-place" state and the dialog element inside the frame.
Why isn't it a modal dialog?
Because feedback is about the page behind it, and a person should be able to scroll, copy a code sample or look at the thing they are describing while they write. A non-modal card doesn't trap focus, doesn't dim the page and doesn't lock scrolling; Escape still closes it and focus goes back to the button. It is a Popover, which is non-modal, with the trigger passed through render.
How does the 400-character count work?
The Textarea stops at 400, and the count beside its label, such as 212 / 400, is visible but hidden from screen readers, because a number that changes on every key would be read out on every key. A polite message speaks only at stages: 20 characters to go, 10 to go, and "Limit reached". The count is the length of the text as typed, not words. In your app enforce the same limit on your server.
What does the email tick do?
"You may email me about this" turns on the email field under it. The field is always there, disabled while the box is empty, so ticking never moves the Send button. With the box ticked, sending checks the address and puts focus in the field if it is wrong; with it empty, no address is asked for and none is kept. The page it is about, "Page: Billing", is a typed chip: in your app fill it from the route.
Is it accessible from the keyboard?
Yes. The card is named by its title and described by its sentence, and a press of the button puts focus in the message. Arrow keys move between the three kinds; Tab goes through the message, the tick, the email and the buttons; Escape closes the card and returns focus to Feedback. An empty message names the problem under the field and puts focus back in it. One polite status message reports the result. The copy shown on load moves no focus; Escape inside it and Cancel close it and put focus on Feedback.
What stays local in the demo, and how do I wire it up?
All of it. Nothing is sent or stored: Send feedback closes the card, the drawn pill reads "Thanks", and a polite message says "Kept in this demo only". In your app post the kind, the message, the page and the address from send, show your server's answer before you close the card, and keep what the person typed if the request fails. Never ask for more than the message.
Related
- Pro
Feedback Rating Dialog
Feedback and reportsA 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
App Rating Dialog
Drawers and popoversA 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.
- Pro
Cookie Consent Dialog
Drawers and popoversA recipe blog's first-visit cookie card shown open over its page: two sentences, then Reject all and Accept all as two equal outline buttons side by side, with no primary. It isn't modal, so the page stays readable, and the choice is written on the page's foot.
- Pro
Feature Request Dialog
Feedback and reportsA 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
Page Feedback Footer
PreferencesA footer that asks whether the page was helpful: a Yes and No toggle that opens a note form with validation, a status line that thanks the reader, and two link columns.
- Pro
Contact Support Dialog
Feedback and reportsA shipments table with a support dialog shown open: a ticket form with a category, a priority and attached file names, and beside it up to three help articles picked by the category and the subject's words, each opening in place.