Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

No Coupons Empty State Block for React

A full-height first-coupon screen for a promo tool: a code that is upper-cased as you type, a Percent or Fixed type and a value, a worked-out line for a sample order in whole cents, and a drawn coupon ticket with a perforation that prints the code and the value as you go.

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

Turn a blank coupon list into the first coupon, with this no coupons empty state for React with Base UI. It's the coupons page of Clipstub, a promo tool: the page's two side rails run its full height and one band crosses the screen between two rules with a plus mark where each meets a rail. At the start of the band sit the heading, a Field with an Input for the code (upper-cased and cleaned as you type), a Segment Group that chooses Percent or Fixed, a value, and a line that works out what the coupon does to a sample 50.00 order in whole cents. The Shine Button, the only colored control, creates the coupon, and a list that is one dashed row turns into its row. At the end a greyscale drawing of the coupon ticket stands where a product's mark would: an outline with a notch at each end and two on the perforation, with the code printed on the main part and the value on the stub as you type, and dashed boxes where nothing is typed yet. The band is ruled by Guides, and everything moves with CSS only. For a first-run screen in any store, subscription or campaign tool.

FAQ

What stays in the page, and how do I make it real?

Nothing leaves the page. The coupon is a row kept in the page's state, the 50.00 order is a typed example and the status line says "in this demo. Nothing is applied." To wire it for real, create the coupon with your store's API where the code says so, list what it returns, and apply discounts on the server at checkout, never from a code typed in the browser.

How is the sample worked out?

In whole cents. A percentage takes its share of the 5000 cents of the sample order and rounds to the nearest cent; a fixed amount is read as cents too, and never takes more than the order. The line says what comes off and what is left to pay, and a percentage goes from 1 to 100 while a fixed amount goes up to 500.00. One number formatter writes every figure, in a left-to-right span, so the digits stay Western digits in a right-to-left page, and a keyboard that types Arabic-Indic digits is read as ordinary digits.

What happens to the code as I type?

It is made upper case, anything that is not a letter or a digit is dropped, and it stops at 12 characters, so SPRING-20! becomes SPRING20. The ticket prints the same text, in a left-to-right box in any language. A code needs at least 3 characters before the button turns on.

Why does Create coupon look quiet at first?

A button that is simply disabled can't explain itself, so this one stays in the tab order and keeps its reason in the line above it: "Code: 3 to 12 letters or digits." or what the value needs. Pressing it anyway, or Enter in a field, says the same in the status message, marks the field invalid and moves focus to it. Once both are right the line goes away and the button turns on.

Does the page change height when the coupon is created?

No. The form stays where it is and is only locked until you press Start over, the list row is the same height empty or filled, and the button keeps its place with a new label. The ticket's outline is one drawing with two layers: the dashed one fades out while a solid one fades in. On a phone the ticket moves above the heading, 140 px tall, and the button is pinned to the bottom of the screen.

Is it usable with a keyboard and a screen reader?

Tab runs through the code, the Percent and Fixed choice (arrow keys move between them), the value, Create coupon and Start over. The choice is a labelled radio group, the line under the button is tied to both fields, and one polite status message says what happened. After creating, focus moves to the new row in the list, and the drawing is hidden from assistive technology because the form and the list say the same things.

  • Pro

    A full-height first-plan screen for a billing tool: a name, a price and a Monthly or Yearly switch, a drawn plan card that previews them, and a worked-out line for ten subscribers, with a coin inside two arrows that turns solid when the plan is created.

  • Pro

    A full-height first-invoice screen for an invoicing app: a client field, three line items with the totals worked out in whole cents as you type, and a drawn invoice paper that fills line by line before one Create invoice button lists the draft.

  • Pro

    Credit Top Up Billing

    Payment and invoices

    A credit wallet: the balance and what it will be after the top-up, amount chips with a custom amount, auto-recharge with a threshold and amount, a pay button with a live total and the recent top-ups.

  • Pro

    Referral Rewards Pricing

    Discounts and offers

    Referral pricing as a copyable invite link over a three-step reward track: friends invited and joined (2 of 3), the free months each step pays (1 month, 3 months, a year) and what's already earned.

  • Pro

    Connect Tools Empty State

    Apps and integrations

    A full-height first-run screen for an integration hub: six tool cards with checkboxes at the end, and at the start a drawn hub whose spokes turn from dashed to solid, and whose sockets take a lettermark, as each tool is ticked.

  • Pro

    A full-height first-run screen for a weekly planner: a name field and one Create project button at the start, and at the end a drawn drafting table whose blank sheet is only dashed until the project exists.