Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Mood Check Dialog Block for React

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.

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 log how they feel in a few seconds, with this mood check dialog for React with Base UI. It opens from the Journal of Daydrift, a mood journal: the page's header holds an outline Log mood Button, and the journal home, a How are you today? card over a week strip, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog holds five faces from Rough to Great, drawn from icons with the name under each, as one choice you move through with the arrow keys; the chosen face turns solid. Under them a Toggle Group takes what is behind the mood, any of Sleep, Work, People, Health and Weather, and a Textarea takes an optional note of up to 200 characters, with a counter that is only spoken at 20, 10 and 0 left. Log mood, the only Shine Button, fills today's cell in the drawn week strip with the face and the tags. For preview the dialog is drawn open in place when the page loads; the header button opens the real Dialog, with the same faces and the same state. For journals, wellbeing apps, team check-ins and any app that asks how someone is.

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 Log mood 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 MoodFields component and share the block's state, so a face 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 faces work, and why are they not emoji?

Each face is an icon from the icon set in the current text colour, so it follows the theme, and the name under it (Rough, Low, Okay, Good, Great) is what a screen reader hears. They are native radio buttons in one radio group, so Tab enters the group once and the arrow keys move and choose, in either text direction. The chosen face is solid foreground, never the primary colour, which stays on Log mood. Pressing Log mood before choosing says "Pick how you feel first." in a slot that is always there and puts focus on the faces.

How do the tags and the note work?

Both are optional and independent of the face. The tags are a multiple-choice group, each a toggle that turns solid when it is on, and they wrap onto a second line on a narrow phone without changing the dialog's height. The note stops at 200 characters (the field refuses more); the visible count is hidden from assistive technology and a polite message says "20 characters left", "10 characters left" or "No characters left." only as each stage is crossed, never on every key.

What does Log mood change on the page?

Today's cell in the drawn week strip: it shows the chosen face and, from the small breakpoint up, the tags, and the card above it says "Logged: Good, Sleep and Work". Monday to Thursday hold typed faces, Friday is today and the weekend is empty, all from one fixed day so the preview never ages. The header button then reads Update mood, and the dialog reopens on what was logged; Cancel and Escape drop anything you changed without logging.

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

No. The entry lives in this tab and a polite message says "Logged Good for today, in this demo" and "Nothing was saved or sent". In your app send { mood, tags, note } from log, take the saved entry from the response and show it in the strip. Mood data is sensitive: keep it encrypted, let people export and delete it, and don't share it without consent.

Is it accessible from the keyboard?

Yes. The real dialog is named by its question and described by its sentence, focus starts on the faces 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 tags are a group you move through with the arrow keys, the note has a visible label, 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 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

    Streak Tracker Dialog

    Time and scheduling

    A habit app's list with a daily check-in dialog shown open: a flame and the days in a row, a five-week calendar with this week's days large, milestones at 7, 14 and 30, and a check-in that moves the number.

  • 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

    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

    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

    Report Content Dialog

    Feedback and reports

    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.