Grouped Settings Layout
Sidebar-and-panel settings shell that becomes a horizontal scroller on mobile instead of collapsing into a select.
Destructive actions gated by typing the resource name exactly — the pattern GitHub and Stripe use, and for good reason.
components/settings-danger-zone.tsxnpx hoverlab add settings-danger-zone
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.
These actions affect everyone in the workspace.
Hand this workspace to another member. You keep admin access, but billing and deletion move to them.
Make everything read-only and stop billing at the end of the period. You can un-archive at any time.
Permanently removes all projects, members and history. This cannot be undone and support cannot recover it.
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
'use client'
/**
* <SettingsDangerZone> — the irreversible actions, gated properly.
*
* Destructive confirmation done the way GitHub and Stripe do it: the user
* types the resource's exact name before the button unlocks. A plain
* "Are you sure?" dialog is dismissed by reflex; typing `acme-production`
* cannot be.
*
* The comparison is deliberately exact — not trimmed, not case-folded.
* Loosening it defeats the point, which is to force the user to look at
* what they are about to destroy.
*
* Each action states its consequence and whether it can be undone, because
* "Delete workspace" and "Transfer ownership" carry very different risk and
* a shared red border tells the user nothing about which is which.
*/
import * as React from 'react'
import { TriangleAlert } from 'lucide-react'
export interface DangerAction {
id: string
title: string
description: string
buttonLabel: string
/** Requires typing `confirmValue` before the button unlocks. */
requiresTyping?: boolean
onConfirm?: () => void
}
export interface SettingsDangerZoneProps {
/** The exact string a user must type — usually the workspace name. */
confirmValue?: string
actions?: DangerAction[]
className?: string
}
const DEFAULT_ACTIONS: DangerAction[] = [
{
id: 'transfer',
title: 'Transfer ownership',
description:
'Hand this workspace to another member. You keep admin access, but billing and deletion move to them.',
buttonLabel: 'Transfer',
},
{
id: 'archive',
title: 'Archive workspace',
description:
'Make everything read-only and stop billing at the end of the period. You can un-archive at any time.',
buttonLabel: 'Archive',
},
{
id: 'delete',
title: 'Delete workspace',
description:
'Permanently removes all projects, members and history. This cannot be undone and support cannot recover it.',
buttonLabel: 'Delete workspace',
requiresTyping: true,
},
]
export function SettingsDangerZone({
confirmValue = 'acme-production',
actions = DEFAULT_ACTIONS,
className = '',
}: SettingsDangerZoneProps) {
const [openId, setOpenId] = React.useState<string | null>(null)
const [typed, setTyped] = React.useState('')
const uid = React.useId()
// Exact match. Trimming or case-folding would undo the whole mechanism.
const confirmed = typed === confirmValue
function toggle(id: string) {
setOpenId((current) => (current === id ? null : id))
setTyped('')
}
return (
<section
className={`overflow-hidden rounded-2xl border border-destructive/40 bg-card/60 ${className}`}
>
<div className="flex items-center gap-2 border-b border-destructive/30 bg-destructive/5 px-6 py-4">
<TriangleAlert aria-hidden className="h-4 w-4 shrink-0 text-destructive" />
<div>
<h2 className="font-semibold tracking-tight text-destructive">Danger zone</h2>
<p className="mt-0.5 text-sm text-muted-foreground">
These actions affect everyone in the workspace.
</p>
</div>
</div>
<ul className="divide-y divide-border/40">
{actions.map((action) => {
const open = openId === action.id
return (
<li key={action.id} className="px-6 py-4">
<div className="flex flex-wrap items-start justify-between gap-4">
<div className="min-w-0 flex-1">
{action.title ? (
<h3 data-stress-ignore className="break-words text-sm font-semibold">{action.title}</h3>
) : null}
<p className="mt-1 break-words text-sm text-muted-foreground">{action.description}</p>
</div>
<button
type="button"
onClick={() => toggle(action.id)}
aria-expanded={open}
// Only while the confirmation exists — it is unmounted
// when collapsed, and a dangling IDREF is worse than none.
aria-controls={open ? `${uid}-${action.id}-confirm` : undefined}
className="shrink-0 rounded-xl border border-destructive/50 px-3.5 py-2 text-sm font-semibold text-destructive transition-colors hover:bg-destructive/10"
>
{action.buttonLabel}
</button>
</div>
{open ? (
<div
id={`${uid}-${action.id}-confirm`}
className="mt-4 rounded-xl border border-destructive/30 bg-destructive/5 p-4"
>
{action.requiresTyping ? (
<>
<label
htmlFor={`${uid}-confirm-${action.id}`}
className="block text-sm font-medium"
>
Type{' '}
<code className="rounded bg-background px-1.5 py-0.5 font-mono text-xs">
{confirmValue}
</code>{' '}
to confirm
</label>
<input
id={`${uid}-confirm-${action.id}`}
autoComplete="off"
autoFocus
value={typed}
onChange={(e) => setTyped(e.target.value)}
className="mt-2 w-full max-w-sm rounded-xl border border-border/60 bg-background px-3 py-2 font-mono text-sm outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-destructive"
/>
</>
) : (
<p className="text-sm">
This will {action.title.toLowerCase()}. Continue?
</p>
)}
<div className="mt-4 flex items-center gap-2">
<button
type="button"
disabled={action.requiresTyping && !confirmed}
onClick={() => {
action.onConfirm?.()
toggle(action.id)
}}
className="rounded-xl bg-destructive px-3.5 py-2 text-sm font-semibold text-destructive-foreground transition-opacity hover:opacity-90 disabled:opacity-40"
>
I understand — {action.buttonLabel.toLowerCase()}
</button>
<button
type="button"
onClick={() => toggle(action.id)}
className="rounded-xl px-3.5 py-2 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground"
>
Cancel
</button>
</div>
</div>
) : null}
</li>
)
})}
</ul>
</section>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/settings-danger-zone.tsx and import it where you need the section:
import { SettingsDangerZone } from '@/components/settings-danger-zone'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 |
|---|---|---|
confirmValueThe exact string a user must type — usually the workspace name. | string | 'acme-production' |
actions | DangerAction[] | DEFAULT_ACTIONS |
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.
<!--
Danger Zone — 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.
-->
<section class="overflow-hidden rounded-2xl border border-destructive/40 bg-card/60 ">
<div class="flex items-center gap-2 border-b border-destructive/30 bg-destructive/5 px-6 py-4">
<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-triangle-alert h-4 w-4 shrink-0 text-destructive" aria-hidden="true">
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"></path>
<path d="M12 9v4"></path>
<path d="M12 17h.01"></path>
</svg>
<div>
<h2 class="font-semibold tracking-tight text-destructive">Danger zone</h2>
<p class="mt-0.5 text-sm text-muted-foreground">These actions affect everyone in the workspace.</p>
</div>
</div>
<ul class="divide-y divide-border/40">
<li class="px-6 py-4">
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="min-w-0 flex-1">
<h3 data-stress-ignore="true" class="break-words text-sm font-semibold">Transfer ownership</h3>
<p class="mt-1 break-words text-sm text-muted-foreground">Hand this workspace to another member. You keep admin access, but billing and deletion move to them.</p>
</div>
<button type="button" aria-expanded="false" class="shrink-0 rounded-xl border border-destructive/50 px-3.5 py-2 text-sm font-semibold text-destructive transition-colors hover:bg-destructive/10">Transfer</button>
</div>
</li>
<li class="px-6 py-4">
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="min-w-0 flex-1">
<h3 data-stress-ignore="true" class="break-words text-sm font-semibold">Archive workspace</h3>
<p class="mt-1 break-words text-sm text-muted-foreground">Make everything read-only and stop billing at the end of the period. You can un-archive at any time.</p>
</div>
<button type="button" aria-expanded="false" class="shrink-0 rounded-xl border border-destructive/50 px-3.5 py-2 text-sm font-semibold text-destructive transition-colors hover:bg-destructive/10">Archive</button>
</div>
</li>
<li class="px-6 py-4">
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="min-w-0 flex-1">
<h3 data-stress-ignore="true" class="break-words text-sm font-semibold">Delete workspace</h3>
<p class="mt-1 break-words text-sm text-muted-foreground">Permanently removes all projects, members and history. This cannot be undone and support cannot recover it.</p>
</div>
<button type="button" aria-expanded="false" class="shrink-0 rounded-xl border border-destructive/50 px-3.5 py-2 text-sm font-semibold text-destructive transition-colors hover:bg-destructive/10">Delete workspace</button>
</div>
</li>
</ul>
</section>
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.
Avatar, fields and a character counter, with a sticky save bar that only appears once something has genuinely changed.
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.
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.