Grouped Settings Layout
Sidebar-and-panel settings shell that becomes a horizontal scroller on mobile instead of collapsing into a select.
Avatar, fields and a character counter, with a sticky save bar that only appears once something has genuinely changed.
components/settings-profile-form.tsxnpx hoverlab add settings-profile-form
Or over MCP, from your editor's agent — no account needed.
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Start a page with this section — add more, order them, and leave with the page source.
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
'use client'
/**
* <SettingsProfileForm> — name, email, bio and avatar, with a save bar.
*
* The save bar only appears once something has actually changed, and it is
* sticky to the bottom of the panel. A form with a permanently enabled
* Save button gives no signal about unsaved work; one where the button
* scrolls off the end of a long form gives no way to reach it.
*
* "Dirty" is computed by comparing against the initial values rather than
* being set by every onChange, so typing a character and deleting it
* correctly returns the form to clean.
*/
import * as React from 'react'
import { Loader2, Upload, Check } from 'lucide-react'
export interface ProfileValues {
name: string
email: string
bio: string
}
export interface SettingsProfileFormProps {
initial?: ProfileValues
onSave?: (values: ProfileValues) => Promise<void>
bioLimit?: number
className?: string
}
const DEFAULT_VALUES: ProfileValues = {
name: 'Ada Lovelace',
email: 'ada@acme.com',
bio: 'Working on compilers and the occasional analytical engine.',
}
export function SettingsProfileForm({
initial = DEFAULT_VALUES,
onSave,
bioLimit = 160,
className = '',
}: SettingsProfileFormProps) {
// Per-instance ids. A literal id in a reusable component is a
// collision waiting for the second copy on the page — and a <label>
// then resolves to whichever input rendered first.
const uid = React.useId()
const [values, setValues] = React.useState(initial)
const [busy, setBusy] = React.useState(false)
const [saved, setSaved] = React.useState(false)
const dirty =
values.name !== initial.name ||
values.email !== initial.email ||
values.bio !== initial.bio
const overLimit = values.bio.length > bioLimit
function set<K extends keyof ProfileValues>(key: K, value: ProfileValues[K]) {
setValues((v) => ({ ...v, [key]: value }))
setSaved(false)
}
async function handleSubmit(event: React.FormEvent) {
event.preventDefault()
if (!dirty || overLimit || busy) return
setBusy(true)
try {
await onSave?.(values)
setSaved(true)
} finally {
setBusy(false)
}
}
return (
<form
onSubmit={handleSubmit}
className={`overflow-hidden rounded-2xl border border-border/60 bg-card/60 ${className}`}
>
<div className="border-b border-border/60 px-6 py-4">
<h2 className="font-semibold tracking-tight">Profile</h2>
<p className="mt-0.5 text-sm text-muted-foreground">
This is how you appear to everyone else in the workspace.
</p>
</div>
<div className="space-y-6 p-6">
{/* Avatar */}
<div className="flex items-center gap-4">
<span
aria-hidden
className="flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-muted text-lg font-bold text-foreground/70"
>
{values.name
.split(' ')
.slice(0, 2)
.map((w) => w[0] ?? '')
.join('')
.toUpperCase()}
</span>
<div>
<button
type="button"
className="inline-flex items-center gap-2 rounded-xl border border-border/60 bg-background px-3 py-2 text-sm font-medium transition-colors hover:bg-muted"
>
<Upload aria-hidden className="h-4 w-4" />
Upload photo
</button>
<p className="mt-1.5 text-xs text-muted-foreground">
JPG, PNG or GIF. 2 MB maximum.
</p>
</div>
</div>
<div className="grid gap-5 sm:grid-cols-2">
<div>
<label htmlFor={`${uid}-profile-name`} className="mb-1.5 block text-sm font-medium">
Full name
</label>
<input
id={`${uid}-profile-name`}
autoComplete="name"
value={values.name}
onChange={(e) => set('name', e.target.value)}
className="w-full rounded-xl border border-border/60 bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-primary"
/>
</div>
<div>
<label htmlFor={`${uid}-profile-email`} className="mb-1.5 block text-sm font-medium">
Email
</label>
<input
id={`${uid}-profile-email`}
type="email"
autoComplete="email"
value={values.email}
onChange={(e) => set('email', e.target.value)}
className="w-full rounded-xl border border-border/60 bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-primary"
/>
<p className="mt-1.5 text-xs text-muted-foreground">
Changing this sends a confirmation link to the new address.
</p>
</div>
</div>
<div>
<div className="mb-1.5 flex items-baseline justify-between">
<label htmlFor={`${uid}-profile-bio`} className="block text-sm font-medium">
Bio
</label>
<span
className={`text-xs tabular-nums ${
overLimit ? 'font-medium text-destructive' : 'text-muted-foreground'
}`}
>
{values.bio.length}/{bioLimit}
</span>
</div>
<textarea
id={`${uid}-profile-bio`}
rows={3}
aria-invalid={overLimit}
value={values.bio}
onChange={(e) => set('bio', e.target.value)}
className={`w-full resize-y rounded-xl border bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow focus-visible:ring-2 ${
overLimit
? 'border-destructive focus-visible:ring-destructive'
: 'border-border/60 focus-visible:ring-primary'
}`}
/>
</div>
</div>
{/* Save bar — only present when there is something to save. */}
{dirty || saved ? (
<div
aria-live="polite"
className="sticky bottom-0 flex items-center justify-between gap-4 border-t border-border/60 bg-card/95 px-6 py-3 backdrop-blur"
>
<span className="text-sm text-muted-foreground">
{saved ? (
<span className="inline-flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400">
<Check aria-hidden className="h-4 w-4" />
Saved
</span>
) : (
'You have unsaved changes'
)}
</span>
<div className="flex items-center gap-2">
<button
type="button"
onClick={() => {
setValues(initial)
setSaved(false)
}}
className="rounded-xl border border-border/60 bg-background px-3.5 py-2 text-sm font-medium transition-colors hover:bg-muted"
>
Discard
</button>
<button
type="submit"
disabled={!dirty || overLimit || busy}
className="inline-flex items-center gap-2 rounded-xl bg-primary px-3.5 py-2 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50"
>
{busy ? <Loader2 aria-hidden className="h-4 w-4 animate-spin motion-reduce:[animation-duration:1.6s]" /> : null}
Save changes
</button>
</div>
</div>
) : null}
</form>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/settings-profile-form.tsx and import it where you need the section:
import { SettingsProfileForm } from '@/components/settings-profile-form'1 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.
Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.
| Prop | Type | Default |
|---|---|---|
initial | ProfileValues | DEFAULT_VALUES |
onSave | (values: ProfileValues) => Promise<void> | — |
bioLimit | number | 160 |
className | string | '' |
The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.
This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.
<!--
Profile Form With Save Bar — markup from the Hoverlab catalog.
This is the block rendered once to HTML and wrapped as a component
file. It is not a port of the React source: the Tailwind classes carry
the design, which is the part that took the work, and they are the same
in every framework.
This block is interactive in React and the handlers are NOT here.
Buttons, toggles and menus render in their initial state and do
nothing until you wire them up.
-->
<form class="overflow-hidden rounded-2xl border border-border/60 bg-card/60 ">
<div class="border-b border-border/60 px-6 py-4">
<h2 class="font-semibold tracking-tight">Profile</h2>
<p class="mt-0.5 text-sm text-muted-foreground">This is how you appear to everyone else in the workspace.</p>
</div>
<div class="space-y-6 p-6">
<div class="flex items-center gap-4">
<span aria-hidden="true" class="flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-muted text-lg font-bold text-foreground/70">AL</span>
<div>
<button type="button" class="inline-flex items-center gap-2 rounded-xl border border-border/60 bg-background px-3 py-2 text-sm font-medium transition-colors hover:bg-muted"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-upload h-4 w-4" aria-hidden="true"><path d="M12 3v12"></path><path d="m17 8-5-5-5 5"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path></svg>Upload photo</button>
<p class="mt-1.5 text-xs text-muted-foreground">JPG, PNG or GIF. 2 MB maximum.</p>
</div>
</div>
<div class="grid gap-5 sm:grid-cols-2">
<div>
<label for="_R_0_-profile-name" class="mb-1.5 block text-sm font-medium">Full name</label>
<input id="_R_0_-profile-name" autoComplete="name" class="w-full rounded-xl border border-border/60 bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-primary" value="Ada Lovelace" />
</div>
<div>
<label for="_R_0_-profile-email" class="mb-1.5 block text-sm font-medium">Email</label>
<input id="_R_0_-profile-email" type="email" autoComplete="email" class="w-full rounded-xl border border-border/60 bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-primary" value="ada@acme.com" />
<p class="mt-1.5 text-xs text-muted-foreground">Changing this sends a confirmation link to the new address.</p>
</div>
</div>
<div>
<div class="mb-1.5 flex items-baseline justify-between">
<label for="_R_0_-profile-bio" class="block text-sm font-medium">Bio</label>
<span class="text-xs tabular-nums text-muted-foreground">58/160</span>
</div>
<textarea id="_R_0_-profile-bio" rows="3" aria-invalid="false" class="w-full resize-y rounded-xl border bg-background px-3.5 py-2.5 text-sm outline-none transition-shadow focus-visible:ring-2 border-border/60 focus-visible:ring-primary">Working on compilers and the occasional analytical engine.</textarea>
</div>
</div>
</form>
What each framework gets across the whole catalog — effects convert properly; this rung is markup.
The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.
Want the whole screen instead of this one section? Open a page and copy it entire.
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse SettingsCopying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
Sidebar-and-panel settings shell that becomes a horizontal scroller on mobile instead of collapsing into a select.
Member list with role selects, pending invites shown inline, and the last owner locked so a workspace cannot be orphaned.
Masked keys, a create flow that reveals the secret exactly once, and a revoke that confirms before it fires.
Destructive actions gated by typing the resource name exactly — the pattern GitHub and Stripe use, and for good reason.
The screen people go looking for after losing a laptop. Sign out everywhere states what it does not reach — API keys keep working — locations are written as estimates, and this device is labelled rather than revocable by misclick.
Every event against every delivery channel in one grid, with column toggles and required rows that show the policy instead of a disabled checkbox.