Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Change Password Account Block for Solid

A change-password form that says what it ends: three password fields with a line naming what the new one still needs, boxes for the other sessions, an app password and trusted devices, and a sentence that follows them.

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

Let people change a password and decide what it should end, with this account form for Solid with Ark UI. A compact header holds the title and one sentence. The form is a hairline frame with a plus mark on each corner and three bands. The first holds the current password, the new one and its repeat, each a Password Input with a show button and a line for its problem; under the new password one line counts how many of five requirements are met and names the first one still missing, with no strength meter. The second asks what changing it should end with three Checkbox rows (the other sessions, the app password, the trusted devices) and a sentence that follows them ("You stay signed in here. 3 other sessions end."). The last is the action foot: a status line, the Shine Button that changes the password and an outline Button that clears the form. On a phone the foot stays pinned to the bottom of the screen. It's built from Password Input, Checkbox, Field, Button, Shine Button and Guides, with a CSS entrance only. For the security page of any app, a forced password change or an account recovery step.

FAQ

How do I change the rules and what the boxes cover?

Edit the constants at the top. NEEDS names the five requirements in the order the line reports the first one missing, and metOf says which a password meets; change both together and the count ("3 of 5"), the line and the refusal on submit all follow, since they are worked out from them. SESSIONS, APP_PASSWORDS and DEVICES are what the account holds besides this session: the box titles and the closing sentence are built from them, so they stay true. DEFAULTS says which boxes start ticked.

What happens when I press Change password, and what stays local?

Nothing leaves the page. The button waits less than a second, then clears the form and says in the status line that the password was updated in this demo and nothing was saved; focus moves to that line, since the button disabled itself while it worked. The button is marked aria-disabled rather than disabled while the form is incomplete, so it keeps its place; pressing it (or Enter in a field) shows each problem and moves focus to the first. In your app, post the current and new passwords to your server in submit, then end the sessions, app passwords and trusted devices the boxes name, and show the server's answer in the same line.

How is the current password checked?

It can't be in a demo: any password of 8 or more characters passes, which the first band says beside the fields. A real app checks it on the server before anything changes, which is the point of asking: someone at an unlocked laptop shouldn't be able to take over the account. Keep the field's autocomplete value so a password manager can fill it.

Why a line instead of a strength meter or a checklist?

A meter guesses; the five requirements are rules, so the line says plainly how many are met and the first one still needed, and the field's problem on submit repeats it. Nothing turns green or red: the count and the words carry it, so it reads the same in any theme and to a screen reader. The line has a reserved height, so typing never moves the fields below it.

Is it accessible?

Every field has a visible label and the show button is named; a problem sits in the line under its field, tied to it with aria-describedby, with an icon and words in the text colour. The three boxes are a fieldset with a hidden legend, each named by its title and described by its line. One polite status line is present from the start. The boxes use the Checkbox's checked and onCheckedChange.

How does it look on a phone?

The bands stack with their title over the fields, the three boxes keep their descriptions under them, and the foot sticks to the bottom of the screen while the form scrolls under it, with Change password and Discard side by side. From the medium breakpoint the foot is simply the last band.