Danger zone explained — Settings block

Pro

settings-danger-zone-explained · for app, settings pages

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.

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-danger-zone-explained

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import SettingsDangerZoneExplained from '@/components/trame/blocks/settings/settings-danger-zone-explained.vue'

const props = {
title: "Danger zone",
intro: "These actions cannot be undone. Take a moment before you go on.",
actions: [
{
id: "leave",
kind: "leave",
title: "Leave workspace",
text: "You lose access to Fernhill Studio until someone invites you again.",
consequences: [
"You can no longer open its 48 projects or their files",
"Tasks assigned to you stay in place, unassigned"
],
action: "workspace.leave"
},
{
id: "transfer",
kind: "transfer",
title: "Transfer ownership",
text: "Hand Fernhill Studio to another admin. You stay on as an admin.",
consequences: [
"The new owner controls billing, the plan and deleting the workspace",
"You can no longer delete or transfer the workspace"
],
confirmText: "Fernhill Studio",
members: [
{
id: "u-ada",
name: "Ada Whitlock",
role: "Admin"
},
{
id: "u-bruno",
name: "Bruno Okafor",
role: "Admin"
}
],
action: "workspace.transfer"
}
]
}
</script>

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

Props

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

PropTypeDescription
titlestringWordsthe zone’s heading ("Danger zone")
introstringWordsa sentence under the heading on what lives here
actions*Action[]the irreversible actions, in the order they are shown; delete usually last
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Action actions[] · 10 props
PropTypeDescription
id*string | numberDatathe action’s key, sent as `id` with its form so the host knows which one ran
kind*'leave' | 'transfer' | 'delete'Designwhat the action does: leave the workspace, transfer its ownership, or delete something for good
title*stringWordsthe action, said as its button says it ("Delete workspace")
textstringWordsone sentence on what happens ("Everything in Northwind Studio is erased for every member.")
consequences*string[]Wordswhat the action destroys or changes, one line each, the most serious first
confirmTextstringWordsthe exact words to type before the action runs, usually the workspace’s name ("Northwind Studio"); matched exactly, case included, spaces around ignored
reasonsstring[]Wordsan optional survey: reasons to tick, sent as `reasons`; never required
membersMember[]for a transfer: the members who can become the owner, one to choose, sent as `newOwner`
lockedstringWordswhy this person cannot take the action now ("Only the owner can delete the workspace")
action*stringActionruns the action: through the host it receives the form’s fields `id`, `confirm` (the typed words), `reasons` (a list), `newOwner` and `acknowledge`; posted natively, the same names. The host checks them again: the block only holds the button until they match. Without it, or when the page lacks it, the action is not shown
Member actions[].members[] · 6 props
PropTypeDescription
id*string | numberDatathe member’s id, sent as `newOwner` when they are chosen
name*stringWordsthe person’s name
rolestringWordstheir role or job title
companystringWordswhere they work
avatarstringPicturea picture: a root-relative path (/media/…) or an absolute URL
urlstringDesigna page about them
Options options · 1 props
PropTypeDescription
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: form.submit
  • Reads members 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 webhooks: Endpoint cards with event subscriptions and delivery status for the merchant’s own webhooks only.
  • 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.
  • Appearance rows: Appearance among other settings pages: one quiet row per setting, its label and explanation on the left and its control on the right.
  • Appearance theme cards: The app offers preset themes: large mode cards (System, Light, Dark) each drawing the app, theme cards with their colours, then the brand colour and the logo below.
  • 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