shadcn.io is not affiliated with official shadcn/ui
Privacy Notice Login Block for React
A split sign-in page for a patient portal: a Why we ask button under each field opens one sentence on why it is needed, a data list says what the portal keeps, and a required privacy box names itself when it is left unticked.
Installation
Overview
Explain each question before it is asked, with this privacy notice login block for React with Base UI. It's the sign-in of Meadowpath Health, a patient portal: the page's two side rails run its full height, and one band crosses the screen between two rules, split by a divider that meets both with a plus mark. The form is at the start. Each field's label row ends in a quiet "Why we ask" button that opens one sentence under the field, why it is needed and how long it is kept, in the same two lines the field's problem uses, so opening one moves nothing. A required Checkbox says the privacy notice was read, and the Shine Button signs in. At the end, behind the divider, a Data List gives the short version of the notice: where details are stored, for how long, who reads them and who never gets them (under the form on a phone). Sign in is never disabled: a wrong field or an unticked box is named under it and takes focus. It's built from Field, Input, Password Input, Checkbox, Data List, Button, Shine Button and Guides, with CSS entrances only. For health, banking and any sign-in that should say what happens to its data.
FAQ
What happens when I sign in, and what stays in the page?
Nothing leaves the page. Sign in waits under a spinner for less than a second, then shows "You're signed in" with the address you typed and the notice version you read, and a polite status message says nothing was sent; Sign out brings the form back. For real, post the email, the password and the version of the notice that was read from the submit handler where the code says so, keep the busy state until the server answers and show its error under the field it concerns. The notice version and the rows of "What Meadowpath keeps" are typed constants at the top of the file: replace them with the values your policy states.
How do the Why we ask buttons work?
Each is a button with aria-expanded and aria-controls pointing at its sentence, named "Why we ask for your email" or "Why we ask for your password" for assistive technology while showing the short words. Pressing it shows the sentence under the field and pressing again hides it; the sentence stays while you type. The space for it is always reserved: it is the same two lines the field's problem uses, so nothing moves when you open one, press Sign in or fix a field. If the field has a problem showing, opening its reason replaces the problem line until the next press of Sign in.
Should a sign-in page ask people to accept a privacy notice?
Ask for what the law and your lawyer say, and say it plainly. Reading a notice is usually not a consent to process data; consent is for optional uses like marketing, which should be separate and never pre-ticked. This block shows a required confirmation box because the plan asks for one: the box is never pre-ticked, pressing Sign in without it marks it and says so, and the version you store with the sign-in is the one that was on screen. Drop the box if you only need to link the notice.
Where do the figures in the summary come from?
From KEPT, a typed list at the top of the file, and NOTICE, the version and its effective day. They are example values for a fictional portal: replace them with what your own notice says, and keep the summary short, with a link to the full text. A summary that disagrees with the notice is worse than none, so change both together.
Is it usable with a keyboard and a screen reader?
Yes. Tab runs through the email, its Why we ask button, the password, its show and hide toggle and Why we ask button, the checkbox and its link, Sign in and the quiet link, then the summary. Enter in a field signs in. Each problem is tied to its field with aria-describedby, focus goes to the first problem, and after signing in it moves to the result's heading while a polite status message says what happened. Pressing anywhere on the checkbox's row ticks it.
How does it look on a phone?
The summary moves under the form behind a rule, so the form and Sign in come first and end on the first screen. The Why we ask buttons stay at the end of the label rows, and their sentences use the reserved lines under each field, so the page keeps its height as you read them.
Related
- Pro
Terms Consent Login
Sign-up and consentA full-height agreements screen for a tenant app: a select-all checkbox that turns mixed over the two required agreements, an optional product-updates box that is never pre-ticked, and a Continue button that names what is missing instead of being disabled.
- Pro
Cookie Consent Login
Sign-up and consentA bakery subscription's cookie choices shown open over a drawn sign-in page: Essential locked on, Analytics and Marketing switches that start off, and three equal buttons, Reject all, Accept all and Save choices.
- Pro
Security Badges Login
Social proofA full-height sign-in page for a password manager with four hairline cells under the form, each a button whose hover card says what the safeguard is and where it stops.
- 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
Create Account Handle Check Login
Sign-up and consentA sign-up page for a community forum in two columns of fields: a handle with an at sign that checks itself against a typed taken list and offers three tries as buttons, then the email, a password with an eight-character hint and Create account.
- Pro
App Download Login
Split with a panelA reverse split sign-in page for a running tracker: a real QR code of a download link with an iOS and Android switch that re-encodes it, a copyable link, and the sign-in form beside it. On a phone the code gives way to a Get the app link.