@objectifthunes/whiteboard
SAAS PATTERNS

SettingsLayout

Section rail beside a panel, plus SettingsRow for one setting: label and explanation left, control right.


PREVIEW
Email
Weekly digestA Monday summary of invoices sent, paid and overdue.
MentionsEmail me when a teammate mentions me in a comment.
Product newsOccasional updates about new features. No more than monthly.
Digest frequencyHow often the summary is sent.
Time zoneDigests are sent at 9am in this zone.
SOURCE
import { SettingsLayout, SettingsRow, Switch } from '@objectifthunes/whiteboard'

{/* switch in place */}
<SettingsLayout
  sections={SECTIONS}
  active={section}
  onSectionChange={setSection}
>
  <SettingsRow
    title="Weekly digest"
    description="A Monday summary of invoices sent, paid and overdue."
    control={<Switch checked={digest} onChange={onDigest} aria-label="Weekly digest" />}
  />
</SettingsLayout>

{/* or navigate: give sections an href, and each one becomes a real URL */}
<SettingsLayout
  sections={SECTIONS.map(s => ({ ...s, href: `/settings/${s.id}` }))}
  active={active}
  renderLink={(section, props) => <Link {...props} href={section.href!} />}
>{children}</SettingsLayout>
NOTES

Works either way round. Give sections an href and it navigates, so each section is a real URL you can link a support article to; give it onSectionChange and it switches in place, which suits a settings Modal.

It is not Tabs. Tabs are for sibling views of the same object. This is for a page whose sections each own different data and save independently.

SettingsRow's description is not optional in spirit. A row whose effect is not spelled out is a row people leave alone, and toggles nobody dares touch are dead weight in the product. Use stacked when the control is wide, like the time zone Combobox above.

Under 880px the rail becomes a horizontal scroller above the panel and the hints are hidden, because a 13rem sidebar plus a form does not fit a phone.