Skip to content

Settings

Lets people change how a product works for them or for their company, safely and in one place.

Settings are where people change decisions they made earlier. This page decides how settings are grouped, when a change applies, how a mistake is caught, and how a destructive action is kept apart from the rest.

The problem

Settings pages grow by accretion until nobody finds anything. They also hide two risks: a change that people did not mean to make, and a button that deletes something next to a button that saves it. A settings pattern groups related choices, says clearly when a change takes effect and puts irreversible actions behind friction.

Anatomy

PartComponentJob
Section navigationButton, ghost, in a navigation landmarkSwitches between sections of settings.
SectionField set with a legendOne topic: profile, notifications, workspace.
Text fieldsInput and TextareaNames, addresses, notes.
ChoiceSelect, Radio Group and SwitchOne of a few options, or on and off.
Save barButtonAppears when something changed, with Save changes and Discard.
ConfirmationSonnerSays that the change was saved. A typed toast (toast.success) takes the success colour on its icon.
Danger zoneAlert and Alert DialogA hairline apart, a warning alert that says what is lost and that it cannot be undone, one destructive button, and a confirmation that names the consequence.

Blocks

Settings with sections and a save bar

settings-01 has a section navigation on the left: Profile, Notifications and Workspace. Edits wait for you: a bar appears at the bottom with Save changes and Discard as soon as any value differs from what was saved. Saving checks the fields first. An invalid email shows an error under the field and returns you to the Profile section. The Workspace section ends in a danger zone: a warning alert, "This cannot be undone", sits above the Delete workspace button. Deleting the workspace opens an alert dialog where the button stays off until you type the workspace name.

Open in a new tab

Choose it when settings belong together and a person edits several of them in one visit, such as a profile and a set of alerts.

Preferences that apply at once

settings-02 is one long page of sections, each with a title and a description on the left and its controls on the right. There is no save button. Every change applies as you make it, and a status line at the top says what was saved. The Access section changes people's roles with a select, and keeps the owner's role fixed.

Open in a new tab

Choose it when each setting is independent and cheap to undo, such as switches, language and roles.

Behaviour

States

  • Pristine: no save bar.
  • Changed: the save bar appears, fixed to the bottom, with the words "You have unsaved changes."
  • Invalid: after the first save attempt the field shows its error and the section with the first error opens.
  • Saved: the bar leaves and a confirmation appears.
  • Immediate: in the version that applies at once, a status line names the change and the control stays where it is.
  • Disabled by rule: a control that cannot change, such as the owner's role, is disabled and the reason is written next to it.

Responsive behaviour

WidthBehaviour
1280px and widerSection navigation in a 12rem column. The form is at most 36rem wide, so lines stay readable.
768px to 1279pxSame as above.
Below 768pxSection navigation becomes a row above the form, which scrolls sideways inside its own container. Titles and descriptions sit above their controls.
320pxSame as below 768px. The save bar buttons stay on one line.

Keyboard and focus

KeyAction
TabMoves through the section navigation, then through every field in reading order.
EnterSubmits the form when focus is in a text field, which saves or shows the errors.
SpaceFlips the focused switch, ticks the focused option or presses the focused button.
Arrow DownMoves to the next option in a radio group or an open select.
EscCloses the open select or the confirmation dialog without changing anything.

When the confirmation dialog opens, focus moves into it. It returns to the Delete workspace button when the dialog closes.

On a phone

Both blocks put pointer-coarse:touch-controls on the page, on the select lists and on the delete confirmation. Settings are a form a person also edits from a phone, and the save bar fixed to the bottom is the primary action. See Sizing.

Accessibility

  • Group related fields in a fieldset with a legend, so screen readers announce the group name before each field.
  • Every field has a visible label tied to it. A placeholder is not a label.
  • Mark invalid fields with aria-invalid and show the error text in an element with role="alert", which the field error does for you.
  • Announce saves with a status or a toast. A visual bar alone is not enough.
  • The destructive action says what it deletes in its name and in its dialog.
  • The current section in the navigation has aria-current="page".

Content

  • Name sections after what they hold: Profile, Notifications, Workspace.
  • Write the label as the thing, and the description as the consequence: "Order alerts. When an order waits for your approval or arrives late."
  • Write errors that say how to fix the problem: "Enter an email address such as giulia@brevia.example."
  • Name the button after the result: Save changes, Delete workspace. Never OK.
  • In a danger zone, say what is lost, what stays and that it cannot be undone.

Delete workspace

Removes every order, inspection and person from Silkware. This cannot be undone.

Delete workspace

Removes every order, inspection and person from Silkware. This cannot be undone.

Do

Set the destructive action apart under its own heading, say what it removes and confirm before it runs.

Don’t

Don’t put Delete next to Save changes. One slip removes the workspace.

Install

pnpm dlx shadcn@latest add @silkware/settings-01
pnpm dlx shadcn@latest add @silkware/settings-02