Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Report Content Dialog Block for React

A community post with a two-step report dialog shown open: five reasons with a line each, then details and a mute switch, then a pane that says what happens next with a reference and an Undo.

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 flag a post and know what happens next, with this report dialog for React with Base UI. It opens from a post in the Knotgarden community feed, a hobby community: the page's header holds an outline Report post Button, and the feed, a post by fern_walker over three more, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog is two steps in one held height. Step 1 asks why, five reasons each with a line under its name, Spam, Harassment, Misinformation, Self-harm and Something else; Continue moves on. Step 2 takes details of up to 300 characters in a Textarea, required for Something else, and a Switch that also mutes the author; Back keeps the choice. Send report, the only Shine Button and a plain primary rather than a destructive one, ends in a pane that says what happens next: a typed reference, the day a moderator reads it, and whether the author is muted, with Undo report. The drawn post then collapses to You reported this post. For preview the dialog is drawn open in place when the page loads; the header button opens the real Dialog, with the same steps and the same state. For communities, comment sections, marketplaces and any content people can report.

FAQ

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

So you can see it without a click. On load the dialog 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. The Report post button opens the real Dialog, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same ReportBody component and share the block's state, so a reason picked in the copy is there in the real one. In your app keep the Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.

How do the steps work, and why doesn't the height change?

The three panes, the reasons, the details and what happens next, sit in one grid cell: the live one is in view and the others stay in place unseen and inert, so the dialog is as tall as the tallest pane at every width and never moves between steps. One Shine Button does all three jobs, labelled Continue, Send report and Done, and the button beside it reads Cancel, Back and Undo report, so focus never leaves the footer's two buttons; each new pane's heading takes focus so a screen reader starts at it. Continue with no reason says "Pick a reason first." and focuses the reasons.

What do the details and the mute switch do?

The details are optional, except for Something else, which needs a few words (the quiet button explains and focuses the field if you send without them). The field stops at 300 characters with a count that is hidden from assistive technology. The switch mutes the author for you, in this tab only, and the last pane and the drawn post both say so. The line under the switch tells the author that a post was reported and never who reported it; for Self-harm it says to contact local emergency services if someone is in danger.

What does the last pane promise, and can I undo it?

Only what the demo can show: a typed reference (KG-4821), the day a moderator reads it, two days after the fixed AS_OF date so it never ages, that the outcome comes in your inbox quoting the reference, and whether the author is muted. Undo report takes everything back and returns to the first step with a polite message; Done closes the dialog and the header button then reads View report, which reopens the dialog on that pane.

Does it report anything, and how do I wire it up?

No. A polite message says "Report KG-4821 sent in this demo" and "Nothing was reported to anyone". In your app send { reason, details, mute } from advance, show the reference your server returns, and keep the third pane. Keep the author's name out of the message to the author, and handle the Self-harm reason with your own safeguards; the copy here is an example.

Is it accessible from the keyboard?

Yes. The real dialog is named by its title and described by its sentence, focus starts on the reasons and stays inside until it closes, and Escape, Cancel and the close button all return focus to the header button. The trigger is passed to DialogTrigger through render, and the dialog is controlled with open and onOpenChange. The reasons are native radio buttons in a radio group, the switch is named for what it does, each problem is announced as an alert, and one polite status message reports what changed. The copy shown on load moves no focus; Escape inside it, Cancel and its close button close it and put focus on the header button.

  • 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

    A bug report on two overshoot cells: a severity segment, steps to reproduce you add and remove (up to six), expected and actual notes, one optional attachment, and a panel that ticks off what the report still needs.

  • Pro

    Confirm Action Dialog

    Confirm and consent

    A newsletter editor with its publish confirmation shown open: an alert dialog that lists what happens to the issue, a box that remembers the answer, and a foot that gives the question back.

  • 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

    A bug-report confirmation inside an app panel: the issue number with a copy button, a triage badge, a five-item completeness list with a progress bar, and an Add button that opens a textarea and ticks the missing item locally.

  • Pro

    Contact Support Dialog

    Feedback and reports

    A 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.