shadcn.io is not affiliated with official shadcn/ui
Captcha Verification Login Block for React
A sign-in page with a human check that never shows a picture: one checkbox that runs a short Checking beat and verifies, escalating to a typed question when the demo switch says the connection looks suspicious.
Installation
Overview
Check that a person is signing in without making them pick traffic lights, with this captcha login block for React with Base UI. It's the sign-in of Stubloft, an event-ticket app: the page's side rails run its full height, and one band crosses the screen between two rules with a plus mark where each meets a rail. Email and password sit above a bordered check bar holding one Checkbox, "Verify you are human". Pressing it shows a spinner for a beat and the bar says "Verified". A Switch under the page, labelled as a demo control, makes the connection look suspicious: the same press then ends in a typed question that drops from the bar ("Type the third word: moon, tree, lamp"), a different one after each miss, and passing it verifies. The Shine Button signs in and is never disabled: pressed before the check passes it marks the bar, says so, and moves focus to it. A good press shows a spinner for a moment, then puts the result in the form's own space and moves focus to it. It's built from Field, Input, Password Input, Checkbox, Switch, Button, Shine Button and Guides, with CSS only. For any sign-in that wants a lighter bot check than a picture grid.
FAQ
What does the check really do, and how do I wire a real one?
Nothing real: it is a typed script. The press waits 800 milliseconds, then either verifies or, with the demo switch on, opens a question whose answers are typed in the file. No service is called, no token is made and nothing is learned about the visitor. For real, put your provider's widget or token call where the code says so (an invisible or checkbox challenge from your bot-protection provider), keep the bar's states, and send the token with the sign-in so your server can verify it before it checks the password. The demo's printed answer under the question is only there so a keyboard user and a test can pass.
Why is there no image grid?
Picture challenges are hard or impossible for many people to pass, depend on one sense, and teach bots faster than they stop them. This check asks for one press, and escalates to a short typed question only when a risk signal says to. Both are readable by a screen reader and usable from a keyboard. A real deployment should also offer a way past the check, such as an email link, for anyone who still can't pass it.
Why is Sign in never disabled?
A disabled button can't say why, and keyboard users can't reach it to find out. Here it stays enabled: pressing it before the check passes marks the bar with an icon, writes "Verify you are human to sign in." under it and moves focus to the checkbox, which reads it. Empty or malformed fields are named the same way, the first problem takes focus, and each field keeps a line for its problem so nothing moves.
How does the typed question work?
With the demo switch on, the check ends in a question that drops from the bar, over the button and links under it, which stop being reachable while it is open. Focus moves to the answer field, Enter or Check answer tests it, and Escape or Cancel steps back to the bar. A wrong answer says so, shows the next question from the typed list and keeps focus in the field; the right one verifies and puts focus back on the bar. Pressing a verified bar clears it so you can run the check again.
Is it usable with a keyboard and a screen reader?
Yes. Tab runs through the email, the password and its toggle, the check bar, Sign in, the quiet link and the demo switch; Space ticks the check. The bar's state ("One press", "Checking…", "One more step", "Verified") is its description, a polite status message announces each change, and the question's field is labelled by the question itself. After signing in, focus moves to the result's heading.
Related
- Pro
Risk Assessment Login
Risk checksA sign-in page that shows why it is asking: six weighted signals add up to a score, a three-zone band marks it, and the question follows the zone: nothing, a six-digit code, or a block.
- Pro
Suspicious Activity Login
Risk checksA page that reports a blocked sign-in after the fact: an incident timeline of three events, the facts of the attempt, then Secure my account (which asks for the password) or This was me.
- Pro
Security Questions Login
Recovery and resetA sign-in step with three security questions where any two correct answers sign in: hints on demand, answers compared without capitals, accents or extra spaces, three attempts, and a locked state with a way out.
- Pro
Centered Sign In Login
Centered formA full-height sign-in page for a team chat app: the product's mark, Google and GitHub rows with lettermark tiles, an or rule, email and password checked on submit, and one Sign in button with a simulated wait and its result.
- Pro
Trust Score Login
Risk checksA sign-in score simulator: four demo switches fill a circular meter in steps of 25 and decide the check, none above 75, a code from 50, an approval below, with a sketch of that check.
- Pro
Location Verification Login
Risk checksA split sign-in page that asks whether a sign-in from far away was you: a drawn map with two places and an arc, a list of facts, and two answers, This is me and Not me.