Profile form


Install
npx shadcn add @klarhimmel/app-settings-profileDetailsAbout, usage, props and more
A profile form: photo, labelled fields with hints and autofill hints, save and cancel, and four states (idle; saving, which disables every field; saved; error, which…
States
profile settings in 4 forms: idle, saving, saved, error.
state: idle
Settings
Your profile
Say who sees this information and where it appears.
state: saving
Settings
Your profile
Say who sees this information and where it appears.
state: saved
Settings
Your profile
Say who sees this information and where it appears.
state: error
Settings
Your profile
Say who sees this information and where it appears.
Notes
When to use it
An account profile form with a photo and a few fields. For inviting another person use app-team-invite; for the irreversible actions that sit below the profile, use app-settings-danger.
Writing for it
- Each field needs a label (40) and a kind: text, email or textarea. The sample (300) is the value the input starts with, not placeholder copy. - Set autocomplete on every field to the matching hint, such as name or email, so browsers can fill the form. Use off for free text like a bio. - Mark exactly one field invalid: true if the error state should point at it. The fieldError text (120) then appears under that field and in the banner.
Watch out for
Saving is a state you set, not an action the block performs: the form never submits. In the saving state every field is disabled, and in the error state only the first field with invalid set is marked.
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Settings' | Text, up to 60 characters. Optional; empty is not rendered. |
title | string | 'Your profile' | Text, up to 120 characters. |
description | string | 'Say who sees this information and w…' | Text, up to 300 characters. Optional; empty is not rendered. |
avatar | { name, change } | {…} | Fields: name, change. |
fields | { label, kind, sample, hint, autocomplete, invalid }[] | 4 items | List of 2 to 6. Each item: label, kind ('text' | 'email' | 'textarea'), sample, hint (optional), autocomplete ('name' | 'given-name' | 'family-name' | 'email' | 'tel' | 'organization' | 'organization-title' | 'url' | 'off'), invalid. |
actions | { save, saving, cancel } | {…} | Fields: save, saving, cancel. |
state | 'idle' | 'saving' | 'saved' | 'error' | 'idle' | One of 'idle', 'saving', 'saved', 'error'. |
messages | { saved, error, fieldError } | {…} | Fields: saved, error, fieldError. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |
Install
Installs
- Avatar
- Banner
- Input
- Textarea
- Button
- About
- A profile form: photo, labelled fields with hints and autofill hints, save and cancel, and four states (idle; saving, which disables every field; saved; error, which marks and describes the flagged field). Never submits.
- States
- Idle, saving, saved and error (the field is marked and described). Set with the state prop. New project? Set it up once: /get-started/installation.