Layout tabs — Settings block
Freesettings-layout-tabs · for app, account pages
Layout tabs
Three to five sections that read as one page of an account (Account, Security, Notifications)
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/settings-layout-tabsUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import SettingsLayoutTabs from '@/components/trame/blocks/settings/settings-layout-tabs.vue'
const props = {
title: "Settings",
sections: [
{
id: "profil",
label: "Shop profile",
group: "Workspace",
icon: "building",
description: "What your customers see in the shop and in their emails.",
groups: [
{
title: "Identity",
help: "The name and description shown in the footer and on invoices.",
fields: [
{
name: "shopName",
label: "Shop name",
required: true,
half: true
},
{
name: "legalName",
label: "Legal business name",
half: true,
placeholder: "Name as registered with the state"
}
]
},
{
title: "Contact details",
help: "Used to reply to customers and for the legal notice.",
fields: [
{
name: "email",
label: "Contact email address",
type: "email",
required: true,
half: true,
placeholder: "[email protected]"
},
{
name: "phone",
label: "Phone",
type: "tel",
half: true
}
]
}
]
},
{
id: "securite",
label: "Security",
group: "Personal",
icon: "shield",
description: "Protect access to your account.",
groups: [
{
title: "Sign-in",
fields: [
{
name: "password",
label: "New password",
type: "password",
help: "At least twelve characters."
},
{
name: "twoFactor",
label: "Two-step verification",
type: "switch",
help: "You’re asked for a code each time you sign in on a new device."
}
]
}
]
}
],
values: {
shopName: "Lumiere Studio",
legalName: "Lumiere Studio LLC",
about: "Handmade lighting from Portland, in small batches.",
email: "[email protected]",
phone: "(503) 555-0100",
language: "en",
currency: "USD",
twoFactor: true,
notifyOrders: true,
notifyReturns: false,
digest: "weekly",
billingAddress: "12 Weaver Street",
zip: "97209",
city: "Portland"
},
submit: "save-settings"
}
</script>
<template>
<SettingsLayoutTabs v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe page ("Settings") |
| sections* | Section[] | the sections shown, in order |
| values | Record<string, unknown> | Datathe account’s current values by field name; an absent value leaves the field empty |
| submit* | string | Actionthe page action that saves the settings: through the host it receives `{ data, section, group? }` (group: the group saved on its own); an image field puts in `data` the File picked, or null once removed, and without the host the form posts as multipart/form-data (the file under the field’s name, `<name>:remove` set to 1 to remove the saved picture); a copy field is never sent |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Section sections[] · 6 props
| Prop | Type | Description |
|---|---|---|
| id* | string | Designthe section’s key |
| label* | string | Wordsthe section in the navigation ("Security") |
| group | string | Wordsthe small heading above this section in the navigation ("Space", "Personal") |
| icon | string | Designuser, shield, bell, card, palette, globe, building, key, mail, users, settings, plug |
| description | string | Wordsone sentence under the section’s title |
| groups* | Group[] | the section’s groups, in order |
Group sections[].groups[] · 3 props
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat the fields of the group are about ("Contact details") |
| help | string | Wordswhat the group changes, in a sentence |
| fields* | Field[] | the form’s fields, in order |
Field sections[].groups[].fields[] · 12 props
| Prop | Type | Description |
|---|---|---|
| name* | string | Designthe key of the field in `values` and in what the form sends |
| label* | string | Wordsthe field’s name ("Email address") |
| type | 'text' | 'email' | 'tel' | 'url' | 'password' | 'number' | 'textarea' | 'select' | 'radio' | 'switch' | 'image' | 'color' | 'copy' | what kind of field it is: text, email, tel, url, password, number, textarea, select, radio, switch; image (a picture to upload, its current address in `values`; posts the file under the field’s name, and `<name>:remove` to remove it), color (a hex colour, with its contrast checked), copy (a read-only value with a copy button, e.g. a workspace id; never sent) |
| help | string | Wordsone sentence on what the field does or how it is used |
| placeholder | string | Wordsan example of the shape expected, never a value that looks real |
| options | Option[] | the choices, for a select |
| required | boolean | true: it must be filled in |
| readonly | boolean | true: the field is shown but cannot be changed |
| half | boolean | half the width of the group on wide screens, two to a row |
| prefix | string | Wordsthe fixed text attached before a text field’s value ("app.example.com/" before a slug); it is not part of what is sent |
| hint | string | Wordsa short note beside the field’s name ("Optional", "Up to 32 characters") |
| shape | 'square' | 'circle' | Designan image field’s preview: square for a logo (the default), circle for an avatar |
Option sections[].groups[].fields[].options[] · 2 props
| Prop | Type | Description |
|---|---|---|
| value* | string | Designwhat is sent |
| label* | string | Wordswhat is read |
Options options · 7 props
| Prop | Type | Description |
|---|---|---|
| savePerGroup | boolean | each group has its own save button (the default for split-rows) |
| dangerZone | DangerZone[] | destructive actions set apart at the end, e.g. "Delete the account" |
| dangerTitle | string | Wordsthe title of the destructive zone ("Sensitive area") |
| saveLabel | string | Wordsthe save button ("Save") |
| discardLabel | string | Wordsthe button that drops the unsaved edits ("Discard changes") |
| unsavedLabel | string | Wordsthe notice shown while edits are not saved ("Unsaved changes") |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
DangerZone options.dangerZone[] · 4 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe destructive action ("Delete the account") |
| help | string | Wordswhat it does and that it cannot be undone |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
record.save,options.dangerZone[] - Reads
settingsfrom your app
A settings section, for app, account pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More settings blocks
- Key list register: A key register with display prefixes, scopes and usage dates for the merchant’s own keys only.
- Language coverage ledger: A language progress ledger beside the selected language’s keys, using the app’s own counts only.
- Notification preferences channel matrix: the same events sent on several channels (e-mail, SMS, push): one table, an event per row and a channel per column; on a phone, a card per event.
- Notification preferences switch groups: notification choices as switches grouped by channel, each with the reason it exists.
- Opening hours compact: one card: the days as a row of chips that open or close them, then only the open days’ hours, the exceptions as short lines: a settings panel or an onboarding step where space is short.
- Opening hours week rows: a ruled row per day, its open switch and its ranges side by side, the exceptions listed under the week: the full settings page of a shop, a restaurant or a practice.
- Opening hours with exceptions: the week in a narrow column beside the dated exceptions, each one a card with its date as a calendar leaf: a business whose year has many closed days and special hours.
- Profile editor compact card: an account with few public fields: one narrow centred card, the portrait on top, a few fields and one full-width save button.