shadcn.io is not affiliated with official shadcn/ui
Coupon Invalid Error Block for React
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.
Installation
Overview
Turn a dead promo code into a better one with this coupon invalid panel for React with Base UI. It's the panel Crustwick, a bakery-box subscription, shows when a code has ended: a compact header over one framed panel on plus-marked corners made with Guides. The first band shows the code that failed in a read-only Input marked invalid, with the reason and how many days ago it ended. The second ranks the offers that work for this exact box as three native radio cells, best saving first: a percentage offer, free delivery, and a third that needs a bigger box and is shown with its shortfall and a hairline meter, disabled and saying why. Choosing one recomputes the box's total from whole cents with one pure helper, shown beside the items, and the Shine Button applies the chosen offer; Remove offer is always there. It is a ranking of what works, not a field that judges a typed code, which the apply coupon dialog already does. For any shop with codes that end.
FAQ
What stays in the page, and how do I apply a real code?
Everything. Choosing an offer changes the previewed total and applying it waits a moment and says, in a polite status line, that the offer was applied in this demo and nothing was sent. To make it real, send the chosen code with the cart to your checkout from apply and take the totals and the ranking back from your server.
How are the offers ranked?
By what each saves on this box, worked out from typed rules in OFFERS: a percentage of the items' total, or the delivery fee. The ones the box qualifies for come first, the biggest saving first; the ones it doesn't qualify for yet come last, nearest first, with how much more the box needs. The saving is never typed twice: the cell, the total and the status line all read the same helper.
Why can't I choose the third offer, and how is that shown?
The box is below its minimum, so its radio is disabled, and the cell says so in words at full contrast ("Add $8.00 to qualify") with a hairline meter of how close the box is. Nothing is faded out, so the cell stays readable in every theme.
Where do the day counts come from?
From typed ISO dates and one fixed "today", worked out with UTC day numbers, so "Ended 31 Dec 2025" and the days since read the same on the server and in every time zone. Nothing reads the clock. In your app, take the end date from the code's record and the day from the server.
How does it work with the keyboard?
The three offers are native radio buttons in a labelled group: Tab reaches the group, the arrow keys move between the offers you can choose, and the chosen cell is a solid tint with a heavy edge and a filled dot. Remove offer is a real button that stays pressable and answers when there is nothing to remove, rather than disappearing.
Related
- Pro
Payment Failed Error
Plans and checkoutA 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
Apply Coupon Dialog
Payments and plansA cookware shop's basket with its promo-code dialog shown open: one field that judges five typed codes with five different answers, applied codes kept as removable chips, and a summary that is worked out again after every change.
- Pro
Form Validation Error
Files and dataA 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.
- Pro
Subscription Required Error
Plans and checkoutA full-screen 403 for a feature the plan does not include: the facts, what Pro adds, and an editable message that asks the workspace owners, with a Viewing as demo control that turns the ask into an upgrade with the price worked out.
- Pro
Booking Unavailable Error
Plans and checkoutA full-screen page for a time that was just taken: the booked slot as a struck chip, the next free times grouped by day, a Shine Button that follows the choice, and a waitlist switch that opens an email field.
- Pro
Sold Out Size Error
Plans and checkoutA full-screen page for a sold-out size: a drawn sweater, a row of five sizes with the sold-out ones struck, a notify field and Shine Button that follow the chosen size, and two similar knits in stock.