Skip to content

Settings page ​

Account settings for a SaaS app: a section nav, profile and password forms with validation, notification choices, billing with invoices and a confirmed account deletion.

Installation ​

bash
npx bootcn add settings-page
bash
pnpm dlx bootcn add settings-page
bash
yarn dlx bootcn add settings-page
bash
bunx --bun bootcn add settings-page

The CLI also installs the design tokens and these blocks and components: card, avatar, field, input, textarea, button, form, checkbox-group, switch, table, badge, alert-dialog. It writes the page with its links already pointing at your asset folders.

Usage ​

bash
npx bootcn add settings-page

The CLI installs every component the page uses and writes settings-page.html to your project root (or paths.pages). Fill the values from your database on the server, give the forms an action (they post normally once they are valid) and check every value on the server again.

JavaScript ​

settings-page.js keeps the dark mode button in sync (Bootcn.settingsPage.setTheme) and marks the nav link of the section you are reading with aria-current.

Accessibility ​

  • A "Skip to content" link, a header, and <main> with one <h1>; each section is a card named by its heading, and the nav links jump to them.
  • Forms show errors next to their fields and in a focused summary (Form); the notification channels keep a minimum (Checkbox group).
  • Deleting the account opens an alertdialog that starts on "Cancel".

Dependencies ​

  • Bootstrap 5.3+ CSS and the JS bundle.
  • The card, avatar, field, input, textarea, button, form, checkbox-group, switch, table, badge and alert-dialog components.

Source ​

The exact files the CLI installs (settings-page@1.0.0). View on GitHub · Report an issue

html
<!doctype html>
<html lang="en" data-bs-theme="light">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Settings · Acme</title>
    <script>
      // Theme before the first paint: the saved choice, else the system setting.
      (function () {
        var theme = null;
        try {
          theme = localStorage.getItem('bootcn-theme');
        } catch (error) {
          theme = null;
        }
        if (theme !== 'dark' && theme !== 'light') {
          theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
        }
        document.documentElement.setAttribute('data-bs-theme', theme);
      })();
    </script>
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.9/dist/css/bootstrap.min.css"
      integrity="sha384-yEPZ7jP9S0QKiUQ0m3jjsO4ProIW7wvR9gXkI7JOGa2XVsw53Yke2bsdkBbjmmiX"
      crossorigin="anonymous"
    />
    <link rel="stylesheet" href="{{bootcn:css}}/tokens.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/button.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/card.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/avatar.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/input.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/select.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/switch.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/label.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/field.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/textarea.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/checkbox.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/form.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/checkbox-group.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/table.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/badge.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/dialog.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/alert-dialog.css" />
    <link rel="stylesheet" href="{{bootcn:css}}/settings-page.css" />
  </head>
  <body>
    <a class="visually-hidden-focusable bootcn-skip" href="#main">Skip to content</a>
    <header class="bootcn-settings__header">
      <div class="bootcn-settings__bar">
        <a class="bootcn-settings__brand" href="#">
          <svg
            class="bootcn-icon"
            width="16"
            height="16"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
            focusable="false"
          >
            <rect x="3" y="3" width="8" height="8" rx="2" />
            <rect x="13" y="13" width="8" height="8" rx="2" />
            <path d="M13 7h8M17 3v8M3 17h8" />
          </svg>
          Acme
        </a>
        <button
          type="button"
          class="btn bootcn-button bootcn-button--ghost bootcn-button--icon bootcn-settings__theme"
          data-bootcn-theme-toggle
          aria-pressed="false"
        >
          <span class="visually-hidden">Dark mode</span>
          <svg
            class="bootcn-icon bootcn-theme-when-light"
            width="16"
            height="16"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
            focusable="false"
          >
            <path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z" />
          </svg>
          <svg
            class="bootcn-icon bootcn-theme-when-dark"
            width="16"
            height="16"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
            focusable="false"
          >
            <circle cx="12" cy="12" r="4" />
            <path
              d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"
            />
          </svg>
        </button>
      </div>
    </header>
    <main id="main" tabindex="-1" class="bootcn-settings">
      <div class="bootcn-settings__intro">
        <h1 class="bootcn-settings__title">Settings</h1>
        <p class="bootcn-settings__lead">
          Manage your profile, notifications, security and billing.
        </p>
      </div>
      <div class="bootcn-settings__layout">
        <nav class="bootcn-settings__nav" aria-label="Settings">
          <ul class="bootcn-settings__nav-list">
            <li>
              <a class="bootcn-settings__nav-link" href="#profile" aria-current="true"
                ><svg
                  class="bootcn-icon"
                  width="16"
                  height="16"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  stroke-width="2"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  aria-hidden="true"
                  focusable="false"
                >
                  <circle cx="12" cy="8" r="4" />
                  <path d="M4 21c0-4 4-7 8-7s8 3 8 7" /></svg
                >Profile</a
              >
            </li>
            <li>
              <a class="bootcn-settings__nav-link" href="#notifications"
                ><svg
                  class="bootcn-icon"
                  width="16"
                  height="16"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  stroke-width="2"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  aria-hidden="true"
                  focusable="false"
                >
                  <path d="M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9" />
                  <path d="M10 21a2 2 0 0 0 4 0" /></svg
                >Notifications</a
              >
            </li>
            <li>
              <a class="bootcn-settings__nav-link" href="#security"
                ><svg
                  class="bootcn-icon"
                  width="16"
                  height="16"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  stroke-width="2"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  aria-hidden="true"
                  focusable="false"
                >
                  <rect x="4" y="11" width="16" height="10" rx="2" />
                  <path d="M8 11V7a4 4 0 0 1 8 0v4" /></svg
                >Security</a
              >
            </li>
            <li>
              <a class="bootcn-settings__nav-link" href="#billing"
                ><svg
                  class="bootcn-icon"
                  width="16"
                  height="16"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  stroke-width="2"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  aria-hidden="true"
                  focusable="false"
                >
                  <rect x="2" y="5" width="20" height="14" rx="2" />
                  <path d="M2 10h20" /></svg
                >Billing</a
              >
            </li>
            <li>
              <a class="bootcn-settings__nav-link" href="#danger"
                ><svg
                  class="bootcn-icon"
                  width="16"
                  height="16"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  stroke-width="2"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  aria-hidden="true"
                  focusable="false"
                >
                  <circle cx="12" cy="12" r="9" />
                  <path d="M12 8v4" />
                  <path d="M12 16h.01" /></svg
                >Danger zone</a
              >
            </li>
          </ul>
        </nav>
        <div class="bootcn-settings__sections">
          <section
            class="card bootcn-card bootcn-settings__card"
            id="profile"
            aria-labelledby="profile-title"
          >
            <header class="bootcn-card__header">
              <h2 class="bootcn-card__title" id="profile-title">Profile</h2>
              <p class="bootcn-card__description">How other people see you in Acme.</p>
            </header>
            <div class="bootcn-card__content bootcn-settings__content">
              <form
                class="bootcn-settings__form"
                data-bootcn-form
                novalidate
                data-success="Profile saved."
                aria-labelledby="profile-title"
              >
                <div class="bootcn-settings__avatar-row">
                  <span class="bootcn-avatar bootcn-avatar--lg" aria-hidden="true"
                    ><span class="bootcn-avatar__fallback">AL</span></span
                  >
                  <div>
                    <button
                      type="button"
                      class="btn bootcn-button bootcn-button--outline bootcn-button--sm"
                    >
                      Change photo
                    </button>
                    <p class="bootcn-field__help mb-0 mt-1">JPG or PNG, up to 2 MB.</p>
                  </div>
                </div>
                <div class="bootcn-field">
                  <label class="bootcn-label" for="settings-name">Name</label>
                  <input
                    class="form-control bootcn-input"
                    type="text"
                    id="settings-name"
                    name="name"
                    value="Ada Lovelace"
                    autocomplete="name"
                    required
                    aria-describedby="settings-name-error"
                    data-error-value-missing="Enter your name."
                  />
                  <p class="bootcn-field__error" id="settings-name-error" hidden></p>
                </div>
                <div class="bootcn-field">
                  <label class="bootcn-label" for="settings-email">Email</label>
                  <input
                    class="form-control bootcn-input"
                    type="email"
                    id="settings-email"
                    name="email"
                    value="ada@example.com"
                    autocomplete="email"
                    required
                    aria-describedby="settings-email-error settings-email-help"
                    data-error-value-missing="Enter your email address."
                    data-error-type-mismatch="Enter an email address like name@example.com."
                  />
                  <p class="bootcn-field__error" id="settings-email-error" hidden></p>
                  <p class="bootcn-field__help" id="settings-email-help">
                    We send receipts and security alerts here.
                  </p>
                </div>
                <div class="bootcn-field">
                  <label class="bootcn-label" for="settings-bio">Bio</label>
                  <textarea
                    class="form-control bootcn-textarea"
                    id="settings-bio"
                    name="bio"
                    rows="3"
                    maxlength="280"
                    aria-describedby="settings-bio-error settings-bio-help"
                  >
Mathematician. Writes the first programs.</textarea>
                  <p class="bootcn-field__error" id="settings-bio-error" hidden></p>
                  <p class="bootcn-field__help" id="settings-bio-help">Up to 280 characters.</p>
                </div>
                <div class="bootcn-settings__actions">
                  <button type="submit" class="btn bootcn-button bootcn-button--default">
                    Save profile
                  </button>
                  <p class="bootcn-form__success" role="status" data-bootcn-form-success></p>
                </div>
              </form>
            </div>
          </section>
          <section
            class="card bootcn-card bootcn-settings__card"
            id="notifications"
            aria-labelledby="notifications-title"
          >
            <header class="bootcn-card__header">
              <h2 class="bootcn-card__title" id="notifications-title">Notifications</h2>
              <p class="bootcn-card__description">Choose how we reach you.</p>
            </header>
            <div class="bootcn-card__content bootcn-settings__content">
              <form class="bootcn-settings__form" action="#" aria-labelledby="notifications-title">
                <fieldset
                  class="bootcn-checkbox-group"
                  data-bootcn-checkbox-group
                  data-min="1"
                  data-error="Keep at least one channel for security alerts."
                  aria-describedby="settings-notify-help"
                >
                  <legend class="bootcn-checkbox-group__legend">Send me notifications by</legend>
                  <p class="bootcn-checkbox-group__help" id="settings-notify-help">
                    Security alerts always use at least one channel.
                  </p>
                  <div class="bootcn-checkbox-group__items">
                    <div class="form-check bootcn-checkbox">
                      <input
                        class="form-check-input bootcn-checkbox__input"
                        type="checkbox"
                        id="settings-notify-email"
                        name="notify[]"
                        value="email"
                        checked
                      />
                      <label
                        class="form-check-label bootcn-checkbox__label"
                        for="settings-notify-email"
                        >Email</label
                      >
                    </div>
                    <div class="form-check bootcn-checkbox">
                      <input
                        class="form-check-input bootcn-checkbox__input"
                        type="checkbox"
                        id="settings-notify-push"
                        name="notify[]"
                        value="push"
                        checked
                      />
                      <label
                        class="form-check-label bootcn-checkbox__label"
                        for="settings-notify-push"
                        >Push notification</label
                      >
                    </div>
                    <div class="form-check bootcn-checkbox">
                      <input
                        class="form-check-input bootcn-checkbox__input"
                        type="checkbox"
                        id="settings-notify-sms"
                        name="notify[]"
                        value="sms"
                      />
                      <label
                        class="form-check-label bootcn-checkbox__label"
                        for="settings-notify-sms"
                        >Text message</label
                      >
                    </div>
                  </div>
                  <p class="bootcn-checkbox-group__error" id="settings-notify-error" hidden></p>
                </fieldset>
                <div class="form-check form-switch bootcn-switch">
                  <input
                    class="form-check-input bootcn-switch__input"
                    type="checkbox"
                    role="switch"
                    id="settings-marketing"
                    name="marketing"
                  />
                  <label class="form-check-label bootcn-switch__label" for="settings-marketing"
                    >Product news and offers</label
                  >
                </div>
                <div class="bootcn-settings__actions">
                  <button type="submit" class="btn bootcn-button bootcn-button--default">
                    Save notifications
                  </button>
                </div>
              </form>
            </div>
          </section>
          <section
            class="card bootcn-card bootcn-settings__card"
            id="security"
            aria-labelledby="security-title"
          >
            <header class="bootcn-card__header">
              <h2 class="bootcn-card__title" id="security-title">Security</h2>
              <p class="bootcn-card__description">Change your password and protect your account.</p>
            </header>
            <div class="bootcn-card__content bootcn-settings__content">
              <form
                class="bootcn-settings__form"
                data-bootcn-form
                novalidate
                data-success="Password changed."
                aria-labelledby="security-title"
              >
                <div class="bootcn-field">
                  <label class="bootcn-label" for="settings-current">Current password</label>
                  <input
                    class="form-control bootcn-input"
                    type="password"
                    id="settings-current"
                    name="current_password"
                    autocomplete="current-password"
                    required
                    aria-describedby="settings-current-error"
                    data-error-value-missing="Enter your current password."
                  />
                  <p class="bootcn-field__error" id="settings-current-error" hidden></p>
                </div>
                <div class="bootcn-field">
                  <label class="bootcn-label" for="settings-new">New password</label>
                  <input
                    class="form-control bootcn-input"
                    type="password"
                    id="settings-new"
                    name="new_password"
                    autocomplete="new-password"
                    minlength="8"
                    required
                    aria-describedby="settings-new-error settings-new-help"
                    data-error-value-missing="Choose a new password."
                    data-error-too-short="Use at least 8 characters."
                  />
                  <p class="bootcn-field__error" id="settings-new-error" hidden></p>
                  <p class="bootcn-field__help" id="settings-new-help">At least 8 characters.</p>
                </div>
                <div class="form-check form-switch bootcn-switch">
                  <input
                    class="form-check-input bootcn-switch__input"
                    type="checkbox"
                    role="switch"
                    id="settings-2fa"
                    name="two_factor"
                    checked
                  />
                  <label class="form-check-label bootcn-switch__label" for="settings-2fa"
                    >Two-factor authentication</label
                  >
                </div>
                <div class="bootcn-settings__actions">
                  <button type="submit" class="btn bootcn-button bootcn-button--default">
                    Update password
                  </button>
                  <p class="bootcn-form__success" role="status" data-bootcn-form-success></p>
                </div>
              </form>
            </div>
          </section>
          <section
            class="card bootcn-card bootcn-settings__card"
            id="billing"
            aria-labelledby="billing-title"
          >
            <header class="bootcn-card__header">
              <h2 class="bootcn-card__title" id="billing-title">Billing</h2>
              <p class="bootcn-card__description">Your plan and past invoices.</p>
            </header>
            <div class="bootcn-card__content bootcn-settings__content">
              <div class="bootcn-settings__plan">
                <div>
                  <p class="bootcn-settings__plan-name">
                    Pro plan <span class="badge bootcn-badge bootcn-badge--default">Current</span>
                  </p>
                  <p class="bootcn-settings__muted">$29 per month · renews on December 1, 2026</p>
                </div>
                <a class="btn bootcn-button bootcn-button--outline" href="#billing-portal"
                  >Change plan</a
                >
              </div>
              <section
                class="table-responsive"
                tabindex="0"
                aria-labelledby="settings-invoices-caption"
              >
                <table class="table bootcn-table">
                  <caption id="settings-invoices-caption">
                    Invoices
                  </caption>
                  <thead>
                    <tr>
                      <th scope="col">Invoice</th>
                      <th scope="col">Date</th>
                      <th scope="col" class="text-end">Amount</th>
                      <th scope="col">Status</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <th scope="row">INV-2026-011</th>
                      <td>Nov 1, 2026</td>
                      <td class="text-end">$29.00</td>
                      <td><span class="badge bootcn-badge bootcn-badge--secondary">Paid</span></td>
                    </tr>
                    <tr>
                      <th scope="row">INV-2026-010</th>
                      <td>Oct 1, 2026</td>
                      <td class="text-end">$29.00</td>
                      <td><span class="badge bootcn-badge bootcn-badge--secondary">Paid</span></td>
                    </tr>
                    <tr>
                      <th scope="row">INV-2026-009</th>
                      <td>Sep 1, 2026</td>
                      <td class="text-end">$29.00</td>
                      <td><span class="badge bootcn-badge bootcn-badge--secondary">Paid</span></td>
                    </tr>
                  </tbody>
                </table>
              </section>
            </div>
          </section>
          <section
            class="card bootcn-card bootcn-settings__card bootcn-settings__card--danger"
            id="danger"
            aria-labelledby="danger-title"
          >
            <header class="bootcn-card__header">
              <h2 class="bootcn-card__title" id="danger-title">Danger zone</h2>
              <p class="bootcn-card__description">Actions that cannot be undone.</p>
            </header>
            <div class="bootcn-card__content bootcn-settings__content">
              <p class="bootcn-settings__muted mb-3">
                Deleting your account removes your projects, invoices and team memberships.
              </p>
              <button
                type="button"
                class="btn bootcn-button bootcn-button--destructive"
                data-bs-toggle="modal"
                data-bs-target="#settings-delete-dialog"
              >
                Delete account
              </button>
            </div>
          </section>
        </div>
      </div>
    </main>
    <div
      class="modal fade bootcn-dialog bootcn-alert-dialog"
      id="settings-delete-dialog"
      tabindex="-1"
      role="alertdialog"
      aria-modal="true"
      aria-labelledby="settings-delete-dialog-title"
      aria-describedby="settings-delete-dialog-description"
      data-bs-backdrop="static"
    >
      <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
          <div class="modal-header">
            <h2 class="modal-title bootcn-dialog__title" id="settings-delete-dialog-title">
              Delete your account?
            </h2>
          </div>
          <div class="modal-body">
            <p class="bootcn-dialog__description" id="settings-delete-dialog-description">
              This permanently deletes your account and your data. You cannot undo it.
            </p>
          </div>
          <div class="modal-footer bootcn-alert-dialog__footer">
            <button
              type="button"
              class="btn bootcn-button bootcn-button--outline"
              data-bs-dismiss="modal"
              data-bootcn-alert-dialog-cancel
            >
              Cancel
            </button>
            <button
              type="button"
              class="btn bootcn-button bootcn-button--destructive"
              data-bs-dismiss="modal"
            >
              Delete account
            </button>
          </div>
        </div>
      </div>
    </div>
    <script
      src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.9/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-WyOxWvTyr1QaMPfiPJSv76iReVthorl5uWlFtZPyK0IEB0hGzo9y5Bp9mYanr8Bu"
      crossorigin="anonymous"
    ></script>
    <script src="{{bootcn:js}}/form.js"></script>
    <script src="{{bootcn:js}}/checkbox-group.js"></script>
    <script src="{{bootcn:js}}/dialog.js"></script>
    <script src="{{bootcn:js}}/alert-dialog.js"></script>
    <script src="{{bootcn:js}}/settings-page.js"></script>
  </body>
</html>
css
.bootcn-skip {
  position: absolute;
  z-index: 1080;
  top: 0.5rem;
  inset-inline-start: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--bootcn-radius);
  background-color: var(--bootcn-background);
  box-shadow: var(--bootcn-focus-ring);
}

[data-bs-theme='dark'] .bootcn-theme-when-light,
[data-bs-theme='light'] .bootcn-theme-when-dark {
  display: none;
}

.bootcn-settings__header {
  border-bottom: var(--bootcn-border-width) solid var(--bootcn-border-color);
}

.bootcn-settings__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 72rem;
  margin-inline: auto;
  padding: 0.625rem 1rem;
}

.bootcn-settings__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--bootcn-foreground);
  font-weight: 700;
  text-decoration: none;
}

.bootcn-settings__brand .bootcn-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.bootcn-settings {
  max-width: 72rem;
  margin-inline: auto;
  padding: 2rem 1rem 4rem;
  outline: 0;
}

.bootcn-settings__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.bootcn-settings__lead,
.bootcn-settings__muted {
  margin: 0.25rem 0 0;
  color: var(--bootcn-muted-foreground);
}

.bootcn-settings__layout {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 992px) {
  .bootcn-settings__layout {
    grid-template-columns: 14rem minmax(0, 1fr);
    align-items: start;
    gap: 2.5rem;
  }

  .bootcn-settings__nav {
    position: sticky;
    top: 1.5rem;
  }
}

/* The nav scrolls sideways on phones instead of widening the grid. */
.bootcn-settings__nav {
  min-width: 0;
}

.bootcn-settings__nav-list {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
}

@media (min-width: 992px) {
  .bootcn-settings__nav-list {
    flex-direction: column;
    overflow: visible;
  }
}

.bootcn-settings__nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--bootcn-radius);
  color: var(--bootcn-muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.bootcn-settings__nav-link:hover {
  background-color: var(--bootcn-accent);
  color: var(--bootcn-foreground);
}

.bootcn-settings__nav-link[aria-current='true'] {
  background-color: var(--bootcn-secondary);
  color: var(--bootcn-foreground);
}

.bootcn-settings__nav-link:focus-visible {
  outline: 0;
  box-shadow: var(--bootcn-focus-ring);
}

.bootcn-settings__sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.bootcn-settings__card {
  scroll-margin-top: 1.5rem;
}

.bootcn-settings__content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.bootcn-settings__form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 32rem;
}

.bootcn-settings__form .bootcn-field {
  margin: 0;
}

.bootcn-settings__avatar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bootcn-settings__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.bootcn-settings__plan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: var(--bootcn-border-width) solid var(--bootcn-border-color);
  border-radius: var(--bootcn-radius-lg);
}

.bootcn-settings__plan-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 600;
}

.bootcn-settings__card--danger {
  border-color: var(--bs-danger);
}
js
/*
 * Settings page: the dark mode toggle. The theme is set before the first
 * paint by the inline script in <head>; this keeps the toggle in sync, saves
 * the choice, and follows the system setting until the user picks one.
 */
(function () {
  'use strict';

  var STORAGE_KEY = 'bootcn-theme';
  var TOGGLE = '[data-bootcn-theme-toggle]';
  var root = document.documentElement;
  var media = window.matchMedia('(prefers-color-scheme: dark)');
  var observer = null;
  var initialized = false;

  function current() {
    return root.getAttribute('data-bs-theme') === 'dark' ? 'dark' : 'light';
  }

  function saved() {
    try {
      return localStorage.getItem(STORAGE_KEY);
    } catch {
      return null;
    }
  }

  function syncToggles() {
    var pressed = String(current() === 'dark');
    document.querySelectorAll(TOGGLE).forEach(function (button) {
      button.setAttribute('aria-pressed', pressed);
    });
  }

  function setTheme(theme, remember) {
    root.setAttribute('data-bs-theme', theme);
    if (remember) {
      try {
        localStorage.setItem(STORAGE_KEY, theme);
      } catch {
        // Storage unavailable (private mode): the choice lasts for this page only.
      }
    }
  }

  function onClick(event) {
    var button = event.target.closest(TOGGLE);
    if (!button) return;
    setTheme(current() === 'dark' ? 'light' : 'dark', true);
  }

  function onSystemChange(event) {
    if (saved() === null) setTheme(event.matches ? 'dark' : 'light', false);
  }

  function init() {
    if (initialized) return;
    initialized = true;
    document.addEventListener('click', onClick);
    media.addEventListener('change', onSystemChange);
    // Keep aria-pressed right whoever changes the theme.
    observer = new MutationObserver(syncToggles);
    observer.observe(root, { attributes: true, attributeFilter: ['data-bs-theme'] });
    syncToggles();
  }

  function destroy() {
    if (!initialized) return;
    initialized = false;
    document.removeEventListener('click', onClick);
    media.removeEventListener('change', onSystemChange);
    if (observer) observer.disconnect();
    observer = null;
  }

  window.Bootcn = window.Bootcn || {};
  window.Bootcn.settingsPage = { init: init, destroy: destroy, setTheme: setTheme };

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', init);
  } else {
    init();
  }
})();

/*
 * Settings page: the nav link of the section on screen gets aria-current.
 */
(function () {
  'use strict';

  var links = Array.prototype.slice.call(document.querySelectorAll('.bootcn-settings__nav-link'));
  if (!links.length) return;

  function mark(id) {
    links.forEach(function (link) {
      if (link.getAttribute('href') === '#' + id) link.setAttribute('aria-current', 'true');
      else link.removeAttribute('aria-current');
    });
  }

  links.forEach(function (link) {
    link.addEventListener('click', function () {
      mark(link.getAttribute('href').slice(1));
    });
  });

  if (typeof IntersectionObserver === 'undefined') return;
  var observer = new IntersectionObserver(
    function (entries) {
      entries.forEach(function (entry) {
        if (entry.isIntersecting) mark(entry.target.id);
      });
    },
    { rootMargin: '0px 0px -70% 0px' },
  );
  links.forEach(function (link) {
    var section = document.getElementById(link.getAttribute('href').slice(1));
    if (section) observer.observe(section);
  });
})();