Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Form Validation Error Block for React

A panel for a request sent with problems: a table of what was found in two groups, must fix and check this, each row with what was typed, the rule and one fix control, and a Shine Button that warns once.

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

Show every problem at once, and fix it where it sits, with this form validation panel for React with Base UI. It's the panel Gaggleby, a group-travel sign-up, shows after a request was sent with problems: a compact header over one framed panel on plus-marked corners made with Guides. A native table lists what was found in two groups. Must fix holds the name that is empty, the phone with 7 of 10 digits and the terms that were not accepted; Check this holds an email domain one typo away from a known one and a departure that falls on a Sunday. Each row shows what was typed, the rule and one fix control: an inline Input (the phone is laid into a pattern as you type), a tick box, or a suggestion button worked out from the data that turns into Undo once used. Fixing a row marks it fixed in place, so nothing moves, and the counts follow. The Shine Button sends the request once no must-fix is open, and warns once about what is still worth checking. For any form that sends first and checks after.

FAQ

What does Send do, and what stays in the page?

Nothing is sent. With a must-fix open, the button says how many and moves focus to the first one; with only checks open, the first press warns and the second sends; with none open it waits a moment and says in a polite status line that the request was sent in this demo and went nowhere. Start over puts the original problems back. To make it real, post the values from send and map your server's field errors onto these rows.

What is the difference between must fix and check this?

A must-fix is something the request can't go without: the name, a ten-digit phone, the accepted terms. A check is something that is allowed but probably a mistake: a domain that looks like a typo (found by comparing it to a short list of known ones, one or two letters apart), or a Sunday departure. Checks never block, they only get one warning.

How are the suggestions worked out?

By small pure helpers over the typed data: the email suggestion is the known domain within two single-letter edits of the one typed, and the date suggestion is the next day when the typed one is a Sunday (the weekday is read from the ISO date in UTC). Using one changes the value and the button becomes Undo, which puts the original back.

Is the table accessible, and what happens on a phone?

It is a native table with a caption, column heads, a row head for each field and a group heading for each of the two groups; the fix controls are real inputs with names. Below the medium breakpoint each row becomes a card (the field and its state, what was typed, the rule, the fix) from the same markup, so a screen reader reads the same thing in both. The table's height stays put: a fixed row height and a reserved two-line rule mean fixing a row changes words, never positions.

How do the counts and the status stay in step?

The visible counts ("2 to fix, 2 to check") are worked out from the values on every render and are hidden from assistive technology; the single polite status line speaks when a row has just been fixed or has come back ("Phone fixed. 2 to fix, 2 to check."), not on every keystroke.

How is this different from an error summary with links?

An error summary lists problems and links to the fields. Here the problems are the interface: each row holds its own fix, so there is nothing to scroll back to. It also keeps what was typed in view beside the rule, which makes the reason for the problem plain.

  • Pro

    Payment Failed Error

    Plans and checkout

    A full-screen page for a declined card payment: the order, the bank's answer, four reasons that each change the fix, and three ways to pay, with a Shine Button that follows the method.

  • Pro

    Coupon Invalid Error

    Plans and checkout

    A panel for a promo code that no longer works: the failed code with why, the offers that do work for this box ranked by saving, and the box's total recomputed as you choose.

  • Pro

    Stylist Booking Contact

    Visits and services

    A salon booking that starts with the person: three stylists in hairline cells, each with their next three openings as chips, a live appointment line, and a form that checks itself and confirms in place.

  • Pro

    Download Failed Error

    Files and data

    A full-screen page for a download that stopped: three requirement cells with a free-space shortfall worked out from typed numbers, three mirrors as radio cells with their latencies, and a retry that fills a bounded bar and stops where the disk would fill.

  • Pro

    Export Failed Error

    Files and data

    A full-screen page for an export that hit its file-size limit: the share written worked out from typed numbers, a real partial CSV with quoting and a formula guard, and a plan that splits the rest by year, quarter or month into files under the limit.

  • Pro

    File Too Large Error

    Files and data

    A full-screen 413 for a clip over the plan limit: a framed staircase of three plan limits with a marker for your file, four compression levels that move it and rewrite the verdict, and a real file picker that reads only name and size.