Forms and settings
How the family asks for information, checks it, and saves it: settings pages where a person changes one thing at a time, and the validation, error, saving, and confirmation rules every form follows.
| Template | 6 of 11, "Settings with one-field edits" (canonical §11, D-BCP-24) |
| Used by | Global ID Me and Security, Tamakkan account, every product's account pages; the form rules also bind sign-in, contact, add-person, and report forms |
| Reference template | reference/templates/settings.html |
| Decisions | D-BCP-24, D-CAI-04, D-CAI-06, D-CAI-09, D-CAI-10, D-CAI-11, D-CAI-13, D-CSN-07, D-CSN-21, D-CSN-22, D-CSN-25, D-CSN-26, D-LAY-11, D-BCP-20 |
Purpose
- Let people change one thing at a time, in plain words, and see at once that it worked: a row opens one field, Save closes it, a snackbar confirms with Undo (canonical §11 row 6, D-CSN-25).
- Make every form in the family behave the same way: labels above, errors on submit then live, one main action that is never disabled, honest messages (D-CAI-04, D-CAI-06, D-CAI-10).
- Show what people cannot change, and who can (D-CAI-10).
When to use
- A page where people check and change their own details or settings: profile, contact details, security, alerts, appearance, language, who can see them.
- Any form in any product. The rules under Forms, Validation, and Saving and confirming apply to sign-in, contact, "Add a person", "Report this job", and every other form.
Use something else when:
| Situation | Use instead |
|---|---|
| One long "Edit profile" form with "Save changes" at the bottom | Never. Split it into rows that each open a one-field edit (canonical §11 row 6) |
| A task with more than about three fields, or wider than 560px | A page of its own, not a modal (D-CSN-21); with three or more steps, a stepper |
| Signing in, creating an account, recovery, step-up | Authentication (template 2), which uses these form rules |
| An administrator changing someone else's record | Admin console: the same one-field edits inside the console shell |
| A message that confirms or fails after the fact | Feedback and status says which container carries it |
Structure
The page lives in the member app shell: a h-dvh grid where only <main> scrolls, the top app bar a grid row, the navigation bar below 768px, and the rail from 768px (D-LAY-09, D-CSN-13).
Desktop (from 1024px)
An annotated outline, top to bottom.
- Skip link "Skip to content", the first focusable element (link).
- Top app bar, 72px: lock-up linking home, the language switcher, the account control.
- Navigation rail, 96px, with the settings destination current (
[aria-current="page"]). <main id="main" tabindex="-1">with the app page frame:mx-auto flex w-full max-w-page flex-col gap-stack-loose md:gap-stack-group(canonical §4.5).- Notices at the top of
mainwhen something needs attention (banner): "Add an emergency contact". - h1 in
text-headline-sm md:text-display-sm: "Security", "Your profile". - Intro, one sentence (never more than two short ones, canonical §12.1),
text-body-lg text-on-surface-variant, at mostmax-w-measure: "Keep your account safe. See where you're signed in and how you sign in." (Global ID). - Groups,
gap-stack-groupapart. Each group is a<section>named by its h2:- h2 in
text-title-lg("Your details", "Alerts", "Where you're signed in"); headings never say "my" (canonical §12.1); - an optional hint, one sentence,
text-body-md text-on-surface-variant: "Details with a lock come from official university records."; - up to five rows in an outlined list card (
.oa-list.oa-list--card): two-line rows of 72px (--size-list-row-two-line), a 1pxoutline-variantrule between them; "Show {count} more" after the fifth (canonical §10.12, §12.3).
- h2 in
- Destructive actions last in their group, as outlined or text buttons: "Sign out everywhere else", "Ask to delete my data".
- The footer's legal links row: "Privacy notice", in the flow at the end of
main, never pinned (footer).
- Notices at the top of
- Snackbar host, empty, mounted at load (snackbar).
A page may add a 320px summary column beside the groups (lg:grid-cols-[minmax(0,1fr)_var(--size-side-pane)]), such as Global ID's "Profile 80% complete" with its progress bar. The column sits at the inline end, so the groups come first in the DOM, because DOM order equals visual order (canonical §4.4, §13).
Phone (below 768px)
- The 64px top app bar (
--size-header-compact) and the 80px navigation bar as the last grid row; onlymainscrolls (canonical §4.8). - h1 in
text-headline-sm. The intro stays; Global ID hides it below 768px today, which this pattern does not require. - Groups stack at
gap-stack-loose(24px); rows run the full card width, start padding 16px (24px from 640px). - A row opens a bottom sheet, never a dialog: Cancel and Save share the width at 56px (canonical §10.19).
- The snackbar sits 16px above the navigation bar:
calc(6rem + env(safe-area-inset-bottom))(canonical §10.21).
In between (768–1023px)
- The rail replaces the bar, the app bar grows to 72px, and the h1 steps up to
display-sm; a row opens a dialog, no longer a sheet (D-CSN-22). - The summary column waits for 1024px; until then it sits under the groups.
Row kinds
| Row | Anatomy | Press | Decision |
|---|---|---|---|
| Editable value | headline = the field's name (title-sm), supporting = the value or "Not added" (body-md, on-surface-variant), trailing chevron_right (24px, mirrored) |
The whole row is one <button> that opens the one-field edit |
D-CSN-07, canonical §11 row 6 |
| Switch | the setting's name as the headline and its hint as the supporting line, a switch in the trailing slot (.oa-switch-field outside lists) |
The switch applies at once | D-CAI-13 |
| Locked value | the value and its reason in the supporting line ("Layla Haddad · From the Registrar"), a 24px lock icon in the trailing slot |
Not pressable; no chevron | D-CAI-10 |
| Link to a page | headline, optional supporting line, trailing chevron_right |
The whole row is one <a> |
D-CSN-07 |
| Choice set on the page | a choice card group, such as "Who can see your details" ("Everyone at GU", "Only my faculty or department", "Only me") | Applies at once (Global ID) | D-CAI-15 |
A row is pressable as a whole or holds controls, never both (canonical §10.12). A switch row is not a button.
One-field edit
One content, two containers: a dialog from 768px and a bottom sheet below it, from one markup (.oa-modal, D-CSN-22).
- Title (
text-headline-sm): the action on the field. "Change your mobile number", "What should we call you?", "Add an emergency contact". - Description (
text-body-md,on-surface-variant): why the value matters and who sees it. "Campus alerts are sent here." - Close button, 48px, "Close", 8px from the top and inline end.
- The field, with its label above, its helper, and its error line (text field). One field; a contact (name, relationship, mobile) is the largest group a modal holds.
- Actions: Cancel first, then Save with a leading
checkat the inline end. Dialog: bothmd, Canceltext. Sheet: bothlgwithflex: 1, Canceloutlined(canonical §10.1, §10.19).
Skeleton
The member shell's main region holds the page (.oa-app-shell__content: the page frame, groups 24px apart, 32px from 768px). The h1 takes .oa-page-title (headline-sm, then display-sm from 768px) and the intro and the group hints take .oa-supporting (on-surface-variant), both from base.css (Tailwind: text-headline-sm md:text-display-sm, text-on-surface-variant).
<main id="main" tabindex="-1" class="oa-app-shell__main">
<div class="oa-app-shell__content">
<h1 class="oa-page-title">Security</h1>
<p class="oa-text-body-lg oa-measure oa-supporting">Keep your account safe. See where you’re signed in and how you sign in.</p>
<section class="oa-stack" aria-labelledby="alerts-title">
<h2 class="oa-text-title-lg" id="alerts-title">Alerts</h2>
<p class="oa-text-body-md oa-supporting">We’ll tell you when something important happens.</p>
<ul class="oa-list oa-list--card">
<li class="oa-list-row oa-list-row--two-line">
<span class="oa-list-row__content">
<span class="oa-list-row__headline" id="alert-device">Email me when someone signs in on a new device</span>
<span class="oa-list-row__supporting" id="alert-device-hint">Sent to <bdi dir="ltr">layla.haddad@example.com</bdi></span>
</span>
<span class="oa-list-row__trailing">
<button class="oa-switch" type="button" role="switch" aria-checked="true" aria-labelledby="alert-device" aria-describedby="alert-device-hint"><span class="oa-switch__track"><span class="oa-switch__thumb"><span class="oa-icon" aria-hidden="true" translate="no">check</span></span></span></button>
</span>
</li>
</ul>
</section>
<section class="oa-stack" aria-labelledby="details-title">
<h2 class="oa-text-title-lg" id="details-title">Your details</h2>
<p class="oa-text-body-md oa-supporting">Details with a lock come from official university records.</p>
<ul class="oa-list oa-list--card">
<li>
<button class="oa-list-row oa-list-row--two-line" type="button" aria-haspopup="dialog">
<span class="oa-list-row__content">
<span class="oa-list-row__headline">Mobile</span>
<span class="oa-list-row__supporting"><bdi dir="ltr">+961 71 214 723</bdi></span>
</span>
<span class="oa-list-row__trailing"><span class="oa-icon oa-icon--mirror" aria-hidden="true" translate="no">chevron_right</span></span>
</button>
</li>
<li class="oa-list-row oa-list-row--two-line">
<span class="oa-list-row__content">
<span class="oa-list-row__headline">Name</span>
<span class="oa-list-row__supporting">Layla Haddad · From the Registrar</span>
</span>
<span class="oa-list-row__trailing"><span class="oa-icon" aria-hidden="true" translate="no">lock</span></span>
</li>
</ul>
</section>
</div>
</main>
<div class="oa-snackbar-host oa-snackbar-host--nav-bar" role="status" aria-live="polite"></div>The edit itself is the .oa-modal of the dialog page ("Change your home address"); the template shows it open beside the snackbar.
Components used
| Part | Component | Notes |
|---|---|---|
| Shell, header, navigation | Top app bar, navigation bar, navigation rail | The member shell of app home |
| Groups and rows | List (.oa-list--card, two-line rows), card |
72px rows, hairlines between them |
| Switch rows | Checkbox, radio, and switch | .oa-switch-field |
| On-page choices | Choice card, segmented button | "Who can see your details"; "Appearance: System / Light / Dark" |
| One-field edit | Dialog, bottom sheet, text field, select | .oa-modal: the same markup in both containers |
| Buttons | Button | One filled per view; Cancel text or outlined |
| Confirmations | Snackbar | "{Field} saved" + "Undo" |
| Notices, form errors | Banner | Error summary, server problems |
| Progress | Progress, skeleton | Profile completeness; loading rows |
Forms
The rules every form in the family follows, settings or not.
- Layout. A form is a column
flex flex-col gap-fields(20px between fields;.oa-stack--fieldsin the reference CSS); fieldsets sitgap-stack-group(32px) apart (canonical §4.5). One-step forms and utility pages aremax-w-form(460px) wide; a form in a modal takes the modal's width (canonical §4.3). - Labels. Every field has a visible
<label for>above it intext-label-md; optional fields add "(optional)" intext-body-md text-on-surface-variant; no asterisks (D-CAI-09, D-CAI-10). - Order and input. Ask only what the task needs, in the order people think of it. Give each field its
type,inputmode, andautocompletetoken; paste always works; values are 16px so phones do not zoom (canonical §10.4, §13). - Placeholders only "For example: …" in full
on-surface-variant, never a label, an instruction, or the only format hint (D-CAI-10). An example email address ends with@gu.edu.lb("For example: name@gu.edu.lb"); the sign-in page alone carries bare placeholders (D-BCP-43). - Phone numbers use the phone fieldset: legend "Phone number", "Country code" defaulting to +961 Lebanon, both boxes
dir="ltr"(D-CAI-11). - One main action. The submit is the view's one
filledbutton:lgon key screens and in sheets,mdin desktop dialogs, full width below 640px (sm). It is never disabled to signal missing or invalid input: people press it and get the errors (D-CAI-04, D-CAI-06). - Reassurance. A form that asks for personal data, money, or commitment has one line under its main action in
text-body-md text-on-surface-variant: "We keep your message and contact details to answer you, and delete them 3 years after we have dealt with them." (Global Jobs contact form; canonical §12.5). - Spam. No CAPTCHA puzzles: a hidden honeypot field and a rate limit (canonical §13).
Validation
| When | What happens | Decision |
|---|---|---|
| Typing, before the first submit | Nothing. No error appears while a person is still typing | D-CAI-10 |
| Submit with errors in a form of five fields or fewer, or with one error in a longer form | Each invalid field gets its error line and [aria-invalid="true"]; focus moves to the first invalid field |
D-CAI-10, canonical §10.4 |
| Submit with two or more errors in a form of more than five fields | The same field errors, plus an error summary at the top of the form that takes focus | canonical §10.4, §13 |
| After the first submit | Each field is checked again as it changes, so an error clears as soon as it is fixed | D-CAI-10 |
| A problem that belongs to no field (server, rate limit, signed out) | An error banner above the main button with role="alert"; the typed values stay |
canonical §10.4 |
| Saving | The submit shows its loading state: "Saving…", a 20px spinner, [aria-busy="true"] and [aria-disabled="true"], its width locked, presses ignored |
D-CAI-06 |
Forms set
novalidate, so browser bubbles never replace the family's messages (canonical §13).A field's error replaces its helper: a filled 16px
erroricon and the words intext-error font-medium; the label stayson-surface. The field links its messages witharia-describedby(the error or the hint, then the lock line). Field messages are never live regions: on a four-error submit they would all speak at once (D-CAI-10).The error summary is an error banner with a title, a sentence, and a list of links, one per invalid field, each repeating that field's error. It gets
tabindex="-1"and focus on submit; following a link puts focus in the field. It is rebuilt on every submit and goes when fewer than two fields fail (D-CSN-26, canonical §13). Global Jobs' contact form is the model (the family adds the sentence "Check the highlighted fields." under the title, canonical §12.4):Your message was not sent Choose what your message is about. · Enter your email or phone number so we can reply. · Write your message (up to 4,000 characters).
Saving and confirming
One-field edits
- The person presses a row. The modal opens and focus moves to its field (canonical §10.19).
- Save checks the value. An error shows under the field and focus stays in it; the modal stays open.
- While saving, Save shows "Saving…" with its spinner and keeps its width.
- On success the modal closes, focus returns to the row, the row shows the new value, and the snackbar says "{Field} saved" with "Undo" for
--duration-dwell-snackbar-action(10 seconds), paused while hovered or focused (D-CSN-25). - "Undo" puts the old value back and says "Change undone".
- If saving fails, the modal stays open with the value as typed and an error banner above the actions: "We couldn't save that. Try again." (Global ID).
Offer Undo only where the old value can come back. Global ID's personal email has none: its confirmation email cannot be unsent, so the snackbar reads "Saved. Check your inbox to confirm your new email." An Undo that matters also has a second path: the person can open the row again and change it back (canonical §10.21).
Switches and on-page choices
- A switch applies at once; there is no Save. The snackbar confirms the new state: "We'll email you about new devices." / "New-device emails are off." (Global ID, D-CAI-13, canonical §11 row 6).
- If the change fails, the switch goes back to its previous position and the snackbar says "We couldn't save that. Try again." with "Try again".
- Inside a form that is submitted later, a setting is a checkbox, never a switch (canonical §10.6).
- A single choice shown on the page applies at once too: Global ID's "Who can see your details" choice cards confirm with "Your choice is saved".
- Appearance. Settings pages offer "Appearance: System / Light / Dark" as a segmented button, stored per account (or in
localStorageunderoa-theme). A product that ships a dark theme also carries the theme toggle in its header: a 48pxdark_modeicon button ("Dark theme",[aria-pressed]) that overrides the system until "System" is chosen (canonical §10.28, D-CSN-56, the client's answer to D-CSN-40).
Locked values
- A value that comes from an official record shows it read-only with a
lockicon and the reason: "From the Registrar", "From IT Services" (Global ID; canonical §11 row 6, D-CAI-10). - Inside a form, a locked field is
readonly, never disabled: it stays focusable and readable, with anoutline-variantedge, no fill, and the lock line linked byaria-describedby(canonical §10.4). - Say who fixes it. Global ID's group hint reads "Details with a lock come from official university records."; its error for a blocked change reads "Only the Registrar can change this."
Destructive actions
They sit last in their group. The trigger is an
outlinedortextbutton with the verb and the thing: "Sign out", "Sign out everywhere else", "Remove" (canonical §10.1).Each opens a confirm modal (
role="alertdialog"): the title asks a question that names the thing, the body says what happens and what cannot be undone, then Cancel and thedangerbutton repeating the question's verb. Focus starts on Cancel (canonical §10.19, D-BCP-20).Sign out of {device}? Anyone using it will have to sign in again to open your apps. Cancel · Sign out
After the action, a snackbar says what happened: "Signed out of {device}". Never "OK", "Yes", or "Are you sure?".
A request that others act on says when, honestly: "This sends a request to the ID office. They will reply within 10 days. Nothing is deleted before then." (Global ID, in its "Ask to delete my data?" dialog).
Content
| Element | Rule | Examples |
|---|---|---|
| Page title | A noun naming the place, no full stop | "Security", "Your profile" |
| Intro | One sentence on what the page is for; two short ones at most | "Check your details and keep them up to date. You change one thing at a time." (Global ID) |
| Row headline | The field's name | "Mobile", "Personal email", "Home address", "Preferred name" |
| Empty value | Plain words, never a dash | "Not added" |
| Modal title | The action on the field, or a plain question | "Change your mobile number", "What should we call you?", "Add an emergency contact" |
| Helper | What it is for, then how to enter the value | "Campus alerts are sent here." · "Choose a country and enter your number without its country code." (Global ID's phone field, D-CAI-11) |
| Field error | Verb first, what to do, an example when a format matters (canonical §12.4) | "Enter an email address, like name@example.com.", "Type their name so Security knows who to ask for." |
| Form failure | What happened, then what to do | "We couldn't save that. Try again.", "You were signed out. Sign in again to save." |
| Success | Object + past participle, no "successfully" | "Mobile number saved", "Preferred name saved", "Your choice is saved" |
| Undo | One verb, then the result | "Undo" → "Change undone" |
- Buttons: "Save", "Cancel", "Send request", never "Submit", "Save changes", or "OK" (canonical §12.3).
- A list of identical "Change" buttons gives each one its field in hidden text ("Change" + "mobile number"), so every name is unique (Global ID's
ChangeButton). - Never "please", "invalid", "oops", or "successfully"; never reveal whether an account exists (canonical §12.4).
| English | Arabic | French |
|---|---|---|
| Mobile number saved | تم حفظ رقم الهاتف | Numéro de mobile enregistré |
| Undo | تراجع | Défaire (native review) |
| Change undone | تم التراجع عن التغيير | Modification annulée |
| Save · Cancel | حفظ · إلغاء | Enregistrer · Annuler |
| From the Registrar | من مكتب التسجيل | Fourni par la Scolarité |
| Sign out of {device}? | هل تريد تسجيل الخروج من {device}؟ | Se déconnecter de {device} ? |
The Arabic and French strings ship in Global ID; "Défaire" waits for native review (canonical §12.3). French puts a narrow no-break space (U+202F) before "?", as the table does (canonical §3.7); Global ID's catalog still has a plain space there.
States
| State | What the page shows |
|---|---|
| Loading (over 1 second) | Each group keeps its h2; its card holds skeleton rows in the final layout (16px text lines at 100%, 80%, and 60%); the region carries [aria-busy="true"] and one hidden "Loading your details…" (canonical §10.23) |
| Empty value | The row reads "Not added" and still opens the edit |
| Attention needed | A banner at the top of main: "Add an emergency contact" with "Add now" (Global ID) |
| Saving | Save in its loading state; the modal stays open |
| Field error | The field's error line; focus in the field |
| Form error | The error banner above the actions, or the error summary at the top of a long form |
| Success | Modal closed, focus on the row, new value shown, snackbar with Undo |
| Signed out while editing | The error banner "You were signed out. Sign in again to save."; the typed value stays |
| Offline | Edits cannot be saved; the snackbar or banner says so with "Try again". See empty, error, and offline |
Accessibility
- One h1, first in
main; each group is a<section>named by its h2 (aria-labelledby). - An editable row is one
<button>with[aria-haspopup="dialog"]; its name is the headline and value. A switch row names the switch by its visible label (aria-labelledby) and describes it by its hint (aria-describedby); the switch keeps the same name in both positions (canonical §10.6). - The modal traps focus, closes on Escape, the scrim, and Close, makes the page inert, and returns focus to the row (canonical §10.19). Native
<dialog>withshowModal()or Radix Dialog. - Targets: rows 72px, switches 64 × 48px, buttons 48 or 56px (canonical §4.6).
- Errors: text + icon,
[aria-invalid="true"],aria-describedby; a failed submit focuses the first invalid field or the summary (canonical §13). - The snackbar host is the page's polite status region, present from load; the snackbar's action stays 10 seconds and waits on hover and focus (WCAG 2.2.1, canonical §13).
- Locked values are readable and focusable, never disabled; the reason is text, not only the lock icon.
RTL and languages
- Rows mirror through logical properties: the leading icon at the right,
chevron_rightmirrored to point left (.oa-icon--mirror); the switch sits at the inline end and its thumb travels from the right in Arabic (canonical §14.2). - Phone numbers, emails, and codes stay left to right inside Arabic:
<bdi dir="ltr">+961 71 214 723</bdi>; their inputs carrydir="ltr"(canonical §14.2). - French runs about 26% longer overall and up to 32% for short labels: labels and modal titles wrap, buttons never truncate; check every modal at 360px in French (canonical §3.7).
- The snackbar sits at the inline start: bottom right in Arabic.
Do and don't
| Do | Don't |
|---|---|
| One row opens one field; the snackbar confirms with Undo | One long form with "Save changes" at the bottom |
| Let a switch apply at once | Put a switch inside a form submitted later; use a checkbox there |
Show a locked value with lock and "From the Registrar" |
Disable the field, or hide who can change it |
| Let people press the main button and show the errors | Disable Save until the form is valid |
| "Enter an email address, like name@example.com." | "Please enter a valid email." |
| "Sign out of {device}?" with "Sign out" and "Cancel" | "Are you sure?" with "OK" and "Cancel" |
| Undo only when the old value can really come back | An Undo that cannot undo (an email already sent) |
Best current example
Global ID's Me and Security pages are the family's model (canonical §11 row 6). They are signed in, so the evidence is the source and the client-approved mock-ups rather than a crawl: Me shows a profile card with "Profile 80% complete", then "My details" rows, each value with "Change", locked rows with "From the Registrar", and "Who can see my details" as choices that apply at once; Security shows "You're well protected", "Where you're signed in" with "Sign out" per device and "Sign out everywhere else", and alerts as switches. On a phone each "Change" opens a bottom sheet with 56px Cancel and Save; on a wide screen, a dialog. Saving ends with the snackbar and Undo. Global Jobs' contact page (/en/contact, 1440px screenshot after an empty submit) is the model of the error summary: "Your message was not sent" with one link per field, above choice cards and fields with "(optional)".
Tamakkan's account page (/account.html, 1440px screenshot) shows what this pattern replaces: a two-column "User details" form, a "Save Changes" button at the end and "Loading..." in the header.
Reference template
reference/templates/settings.html builds Global ID's Me and Security as groups of rows, with a one-field edit open in the responsive modal and the snackbar with Undo showing. It passes the audit gate in light, dark, RTL, and dark RTL at 390px and 1440px.
Related
- Authentication: the sign-in and setup forms, which follow the form rules here.
- Admin console: the same one-field edits on a record.
- Feedback and status: which message for which event.