shadcn.io is not affiliated with official shadcn/ui
Centered Email Capture CTA Block for React
A call to action between solid rails that follows the page theme, in a card in card with a two-step email capture: an email field and a Shine Button, then a six-digit code that verifies on the sixth digit and turns into a confirmation in the same space.
Installation
Overview
A centered call to action that confirms the address before the trial starts, for React with Base UI. It sits between the page's solid side rails under a top rule, in a card in card: a tinted shell with a plus mark on each corner and a raised panel inside it. A two-line headline and a one-line row of four ticks sit above the form. The visitor types an email and presses "Start trial", the Shine Button; after a short spinner the same space becomes "Enter the code we sent to ada@company.com" with a six-slot one-time code field. The sixth digit verifies it (any code works in this demo, after a brief "Checking your code" line) and the space becomes a confirmation. "Use a different email" goes back to the first step. It's built from Field, Input Group, Input OTP, Guides, Shine Button, Button and Spinner, with Lucide icons, Tailwind CSS and CSS transitions that stay still under reduced motion. The panel follows the page: light in a light theme, dark in a dark one. Made for trial and sign-up bands where a verified address is worth one extra step.
FAQ
How do the two steps fit in the same space?
The email form, the code step and the confirmation are stacked in one grid cell. Only the active one is visible: the others are invisible, hidden from assistive technology with aria-hidden and made inert, so they can't be tabbed to or clicked. The cell is as tall as the tallest step, so nothing moves when the step changes and the footer line stays put.
How does the code field work?
Six slots in two groups of three, behind one logical field: typing fills them in order, Backspace goes back, and pasting a whole code fills all six at once. The sixth digit verifies the code by itself. Here any six digits are accepted and a timer (LATENCY) stands in for the request; replace it in verify with a call to your endpoint, and on a wrong code set the phase back to idle, clear the code and say so in the live region.
The slots draw a single real input, which carries the "Six-digit code" name, so paste, autofill and the phone's one-time-code suggestion work as for any input. onComplete fires on the sixth digit.
Where does keyboard focus go?
After each action it follows the step: pressing "Start trial" moves focus to the first code slot, "Use a different email" to the email field, and a verified code to the confirmation, so a screen reader reads it from the start. It never moves on load. A single polite live region announces "Sending your code…", "We sent a six-digit code to…" and "Checking your code…", and is empty otherwise.
How is the email checked?
The form has noValidate and submit calls checkValidity(), which reads the field's type="email" and required. A missing or malformed address shows its message under the field, marks the input invalid and returns focus to it. Typing clears the message.
Related
- Pro
Eligibility Capture CTA
Forms and captureA reverse split call to action that follows the page theme: a framed form with an email field that checks the address as you type and says whether it qualifies, and a Shine Button that stays unavailable, and explains why, until it does.
- Pro
Light Email Capture CTA
Forms and captureA newsletter CTA as a band between solid rails: a headline and a sentence at the start, and at the end one Shine Button that opens in place into an email field with its own Shine submit, closes on Escape and ends in a confirmation.
- Pro
Centered Light Avatar Email Capture CTA
Forms and captureA newsletter call to action in a framed form panel where the topics are toggle chips, each with its author's avatar: pick at least one, add an email, and the confirmation lists what you chose.
- Pro
Split Signup Form Hero
Signup and waitlistA split hero with a sign-up form on the page: copy and ticks at the start, and a card in card form at the end with a work email, a password and a Shine Button that shows a spinner, then a confirmation.
- Pro
Centered Multi Step Form Hero
Signup and waitlistA centered signup hero whose form is a three-step wizard in a card in card, account, plan and payment, that checks each step's fields before the next and ends on a confirmation.
- Pro
Copy Link Share CTA
Forms and captureA band call to action for a referral programme that follows your theme: the pitch beside a read-only invite field with a Shine Button that copies it, real email and system share links, and a closing band counting invites.