Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Quick Reply Dialog Block for React

A helpdesk ticket with its saved-replies dialog shown open: a searchable list of eight replies, a preview filled from the ticket, a flag and a field for each variable it cannot fill, an SMS character count and an Insert reply button that writes into the composer.

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

Answer the same question in seconds without sending the same words twice, with this saved-replies dialog for React with Base UI. It opens from Ticket 48213 on Cairndesk, a helpdesk: the page's header holds an outline Saved replies Button, and the ticket, the customer's message and a composer, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog has a search Input, a Toggle Group of categories (All, Greetings, Billing, Shipping) and an inline Listbox of eight replies with their first lines, and beside it the preview of the chosen one already filled from the ticket: the customer's first name, the order number and the agent. A variable the ticket can't fill is flagged in the preview and gets a small field that fills it as you type, and a count says how many of an SMS's 160 characters the reply uses. Insert reply is the only Shine Button: the text is added to the composer, which is real text, after anything already there. On a phone the list and the preview take turns, with a Back button. For preview the dialog is drawn open in place when the page loads; the header button opens the real Dialog.

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 ticket: a native dialog element that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The Saved replies 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 ReplyFields component and share the block's state, so the reply you chose in the copy is the one 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 are the variables filled?

A reply holds markers such as {{first_name}}, {{order_id}} and {{agent}}. The ticket in TICKET fills those three, so the preview reads "Hi Linnea" at once, with the filled words tinted. Any other marker, such as {{refund_amount}}, is shown dashed and named in a row under the preview that says it needs a value; typing in its field fills the preview as you type, and the row says filled. Insert reply refuses while a value is missing, names it in words and moves focus to its field.

What does the character count measure?

The length of the text as it would be sent, with a marker that has no value yet counting for nothing, against the 160 characters of one SMS. Past it the line says how far over you are and that the reply is too long for one text message but fine for email. It does not stop you: the limit is advice, and the demo sends nothing.

What stays local in the demo, and how do I wire it up?

Everything. The eight replies and the ticket are typed constants, and Insert reply adds the text to the composer in this page's state; nothing is sent. In your app load the replies and the ticket from your helpdesk, keep partsOf for the filling, and send the composer's text from your own send button.

How does it look on a phone?

The copy shown on load docks to the foot of the page as a bottom sheet with its buttons pinned and the content scrolling above them. The list comes first; choosing a reply swaps in the preview, focus moves to its title, and Back to the list returns to the search field. The real dialog keeps the Dialog's own phone layout, a sheet stuck to the bottom of the screen.

  • Pro

    Quick Note Dialog

    Notes and editing

    A sticky-note wall with its dialog shown open: a title, a note of up to 280 characters, an Idea, To-do, Reference or Later label, a reminder day on a calendar and a pin switch, and a new card that lands first on the wall.

  • Pro

    Select Template Dialog

    Pickers and search

    A documents app's new-document dialog shown open: six icon tiles in two columns that move with the arrow keys and jump on a typed letter, Popular and New badges, a Create button that names the choice, and the new file landing on the home.

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

  • 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

    Contact Picker Dialog

    Pickers and search

    A compose window with its recipient picker shown open: a search over fourteen contacts, four recent ones as toggles, an alphabetical list with pinned letters, a To panel of removable chips, and an Add recipients button that fills the message's To line.

  • Pro

    Address Autocomplete Dialog

    Pickers and search

    A meal-kit delivery page with its address dialog shown open: typing filters eight addresses of an invented town into an inline list you can arrow through, a choice fills four editable fields, and Enter it manually offers the same four, empty.