modal dialog settings preferences toggle tabs modal settings preferences toggle tabs configuration options settings modal with tabs preferences dialog with toggles
Modal Settings
Fetch pattern JSON:
curl https://webspire.de/patterns/modal/settings.json settings.html
<div class="flex min-h-64 items-center justify-center">
<button type="button" onclick="this.nextElementSibling.hidden=false" class="rounded-lg bg-[var(--ws-modal-action-bg)] px-5 py-2.5 text-sm font-medium text-[var(--ws-modal-action-text)] shadow transition hover:opacity-90">Open Settings</button>
<div class="ws-modal fixed inset-0 z-50 flex items-center justify-center bg-[var(--ws-modal-overlay)] backdrop-blur-sm" hidden>
<div role="dialog" aria-modal="true" aria-labelledby="modal-settings-title" class="mx-4 w-full max-w-lg rounded-2xl bg-[var(--ws-modal-bg)] shadow-xl">
<!-- Header -->
<div class="flex items-center justify-between border-b border-[var(--ws-modal-border)] px-6 py-4">
<h2 id="modal-settings-title" class="text-lg font-semibold text-[var(--ws-modal-text)]">Settings</h2>
<button type="button" onclick="this.closest('.ws-modal').hidden=true" class="flex h-8 w-8 items-center justify-center rounded-lg text-[var(--ws-modal-text-soft)] transition hover:bg-white/5" aria-label="Close">
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<!-- Tab navigation -->
<div class="flex gap-1 border-b border-[var(--ws-modal-border)] px-6" role="tablist">
<button role="tab" aria-selected="true" class="border-b-2 border-[var(--ws-color-primary)] px-3 py-3 text-sm font-medium text-[var(--ws-modal-text)]">General</button>
<button role="tab" aria-selected="false" class="border-b-2 border-transparent px-3 py-3 text-sm font-medium text-[var(--ws-modal-text-soft)] transition hover:text-[var(--ws-modal-text)]">Notifications</button>
<button role="tab" aria-selected="false" class="border-b-2 border-transparent px-3 py-3 text-sm font-medium text-[var(--ws-modal-text-soft)] transition hover:text-[var(--ws-modal-text)]">Privacy</button>
</div>
<!-- Body: toggle settings -->
<div class="space-y-5 px-6 py-6">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-[var(--ws-modal-text)]">Dark mode</p>
<p class="text-xs text-[var(--ws-modal-text-soft)]">Use dark theme across the application</p>
</div>
<label class="relative inline-flex cursor-pointer">
<input type="checkbox" class="peer sr-only" checked>
<div class="h-6 w-11 rounded-full bg-[var(--ws-color-border)] after:absolute after:left-0.5 after:top-0.5 after:h-5 after:w-5 after:rounded-full after:bg-white after:transition peer-checked:bg-[var(--ws-color-primary)] peer-checked:after:translate-x-5"></div>
</label>
</div>
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-[var(--ws-modal-text)]">Email notifications</p>
<p class="text-xs text-[var(--ws-modal-text-soft)]">Receive updates and alerts via email</p>
</div>
<label class="relative inline-flex cursor-pointer">
<input type="checkbox" class="peer sr-only">
<div class="h-6 w-11 rounded-full bg-[var(--ws-color-border)] after:absolute after:left-0.5 after:top-0.5 after:h-5 after:w-5 after:rounded-full after:bg-white after:transition peer-checked:bg-[var(--ws-color-primary)] peer-checked:after:translate-x-5"></div>
</label>
</div>
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-[var(--ws-modal-text)]">Analytics tracking</p>
<p class="text-xs text-[var(--ws-modal-text-soft)]">Help us improve by sharing usage data</p>
</div>
<label class="relative inline-flex cursor-pointer">
<input type="checkbox" class="peer sr-only" checked>
<div class="h-6 w-11 rounded-full bg-[var(--ws-color-border)] after:absolute after:left-0.5 after:top-0.5 after:h-5 after:w-5 after:rounded-full after:bg-white after:transition peer-checked:bg-[var(--ws-color-primary)] peer-checked:after:translate-x-5"></div>
</label>
</div>
</div>
<!-- Footer -->
<div class="flex justify-end gap-3 border-t border-[var(--ws-modal-border)] px-6 py-4">
<button type="button" onclick="this.closest('.ws-modal').hidden=true" class="rounded-lg border border-[var(--ws-modal-border)] px-4 py-2 text-sm font-medium text-[var(--ws-modal-text-soft)] transition hover:bg-white/5">Cancel</button>
<button type="button" onclick="this.closest('.ws-modal').hidden=true" class="rounded-lg bg-[var(--ws-modal-action-bg)] px-4 py-2 text-sm font-medium text-[var(--ws-modal-action-text)] transition hover:opacity-90">Save</button>
</div>
</div>
</div>
</div>
Details
Responsive Dark Mode Tailwind Only SSR Safe Copy & Paste Requires JS
Stable Published
modaldialogsettingspreferencestoggletabs
Slots
| Name | Required | Description |
|---|---|---|
| title | Yes | Dialog heading text. |
| tabs | Yes | Tab navigation for setting sections. |
| body | Yes | Toggle switches with labels and descriptions. |
| actions | Yes | Cancel and save action buttons. |
Settings modal with header, three tab sections (General, Notifications, Privacy), toggle switches for each setting with label and description, and a cancel/save footer. Tab switching requires minimal JS.