Appearance preview beside — Settings block

Pro

settings-appearance-preview-beside · for app, settings pages

Appearance preview beside

The brand colour is the point: the controls in a column beside a live drawing of the app (sidebar, header, a button, a badge) coloured by the chosen colour, with its contrast checked.

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-appearance-preview-beside

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import SettingsAppearancePreviewBeside from '@/components/trame/blocks/settings/settings-appearance-preview-beside.vue'

const props = {
title: "Appearance",
intro: "Choose how Larkspur looks for everyone in this workspace. Members can still pick light or dark for themselves.",
modes: [
"system",
"light"
],
themes: [
{
id: "harbor",
name: "Harbor",
description: "Calm blues for long planning days",
colors: [
"#2b6cd4",
"#dbe2ff"
]
},
{
id: "orchard",
name: "Orchard",
description: "Warm greens, easy on the eyes",
colors: [
"#2f7d4f",
"#e3f1e7"
]
}
],
brand: {
color: "#2b6cd4",
logo: "data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2048%2048%22%3E%3Crect%20width%3D%2248%22%20height%3D%2248%22%20rx%3D%2212%22%20fill%3D%22%232b6cd4%22%2F%3E%3Cpath%20d%3D%22M15%2012v24h18%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%225%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Ccircle%20cx%3D%2231%22%20cy%3D%2217%22%20r%3D%224%22%20fill%3D%22%23ffd166%22%2F%3E%3C%2Fsvg%3E",
logoAlt: "Larkspur Studio logo"
},
showBranding: {
label: "Show the workspace logo on shared boards",
help: "Guests who open a shared board see your logo and color instead of ours."
},
values: {
mode: "system",
theme: "harbor",
showBranding: true
},
save: "appearance.save",
options: {
saveLabel: "Save appearance"
}
}
</script>

<template>
<SettingsAppearancePreviewBeside v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
titlestringWordsthe panel’s heading ("Appearance")
introstringWordsa sentence under the heading on what these choices change
modes('system' | 'light' | 'dark')[]the colour modes the app offers, in order; all three by default
themesTheme[]the app’s own preset themes; absent, the block offers the brand colour alone
brand*Brandthe workspace’s brand as it is saved: its colour and its logo
showBrandingShowBrandinga switch for showing the brand on what the workspace shares; absent, no switch
valuesValuesthe choices saved now
savestringActionsaves the appearance: through the host it receives `{ patch }` with the fields that changed among `mode`, `theme`, `brandColor` (#rrggbb), `logo` (the `File` picked, `null` once removed) and `showBranding`; posted natively the form is multipart with the same names and `logo:remove` = "1". Without it, or when the page lacks it, the settings are shown read-only
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Theme themes[] · 4 props
PropTypeDescription
id*stringDatathe theme’s key, sent as `theme` when it is chosen
name*stringWordsthe theme’s name ("Harbor")
descriptionstringWordsone short line on its mood ("Calm blues for long days")
colors*string[]Datathe theme’s colours, the brand colour first; choosing the theme sets the brand colour to the first
Brand brand · 3 props
PropTypeDescription
color*stringDatathe workspace’s brand colour now, as #rrggbb
logostringPicturethe workspace’s logo now: a root-relative path or an absolute URL
logoAltstringWordswhat the logo shows, read by screen readers ("Northwind Labs logo")
ShowBranding showBranding · 2 props
PropTypeDescription
label*stringWordswhat the switch turns on ("Show the workspace logo on shared pages")
helpstringWordsone sentence on where it shows
Values values · 3 props
PropTypeDescription
mode'system' | 'light' | 'dark'the colour mode chosen now; system by default
themestringDatathe id of the theme chosen now, if any
showBrandingbooleantrue: the branding switch is on
Options options · 2 props
PropTypeDescription
saveLabelstringWordsthe save button ("Save appearance")
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa band of the page that redefines the theme surfaces inside it
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).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
asseta picture’s address as your app serves it
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour 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:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo 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
  • Subtle motion: one short reveal; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: record.save
  • Reads settings from your app

A settings section, for app, settings 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

  • API keys overview: Two parallel registers of credentials and event destinations for the merchant’s own integrations only.
  • API keys webhooks: Endpoint cards with event subscriptions and delivery status for the merchant’s own webhooks only.
  • Danger zone card rows: At the foot of a settings page: one bordered danger card, a row per action with one sentence and an outlined destructive button that opens its confirmation in place.
  • Danger zone explained: A page given to one grave step ("Delete workspace"): each action its own section, the consequences listed beside the typed name, the "I understand" box and the button, all on the page.
  • Display preferences panel: display preferences (text size, contrast, reduced motion) saved in the visitor’s browser.
  • Domain setup compact: A domain already set up among other settings: one line with its name, status and "Verify", the records folded under a disclosure, open while the domain is not verified.
  • Domain setup steps: Right after the person adds a domain, or someone who has never edited DNS: a numbered guide, first the records to add one by one, then the check.
  • Domain setup table: A domain’s settings page: the domain and its status in a header with "Verify", then every record as a row of a table (type, name, value to copy, status), turned into cards on a phone.

All 38 settings blocks