Dashboard
Dashboard gives your app pages of cards that other modules fill. Shifts adds "Your next shift" to the volunteer home screen, Teams adds "My teams", and neither knows the page. Each user can reorder, hide and collapse the cards, and the layout follows them across devices. For a single area that only your own code fills, use Widget directly instead.
The package is @frigear-nu/dashboard. A dashboard has a dotted name, such as crew.home. It is a
registry on top of Widget: each dashboard is the widget areadashboard.<name>, plus a title and the platforms of each item.
What you get
- Components (on by default):
<Dashboard>draws a dashboard in a responsive grid that packs the items to their sizes, with an edit mode to move, resize, hide and show items.DashboardGrid,DashboardItem,ChartCard,ActionCardandEmptyCardare the building blocks. - Composables and helpers (on by default):
useDashboardreads a dashboard for a page that lays it out itself,useDashboardItemgives an item its loading, error, collapsed and settings state, andextendDashboardadds items from a module. - Per-user layout (on with Preferences): the order, sizes, hidden and collapsed items and item settings are saved as the
dashboardLayoutspreference, read and written throughGET/PATCH /api/dashboard/me/layouts. - Hub (on with Auth): a signed-in page at
/dashboardwith a greeting, a compact row of shortcuts to the areas of thedashboardmenu and the user's ownhomedashboard below it, in a side navigation like the account area's. - Mobile Home tab (on with Mobile): a Home tab at
/crewthat drawscrew.home.
An item's component loads only when its dashboard is drawn.
@frigear-nu/widget, @frigear-nu/ui and
@frigear-nu/module-kit.You add: nothing else.Optional:@frigear-nu/preferences to save each user's layout,
@frigear-nu/auth for the hub, @frigear-nu/authorization
to guard it, @frigear-nu/menu for its navigation,
@frigear-nu/mobile for the Home tab, and @nuxtjs/i18n to translate titles.Quick setup
Install Dashboard
pnpm add @frigear-nu/dashboard
Add it to nuxt.config.ts
export default defineNuxtConfig({
modules: ['@frigear-nu/dashboard'],
})
Draw a dashboard
With Auth installed, the hub at /dashboard draws the home dashboard. Any other dashboard goes on a page
of yours; Crew draws crew.home at /crew, and a page of your own at that path takes its
place.
<template>
<div class="flex flex-col gap-4">
<PageHeading title="Home" />
<Dashboard name="crew.home" />
</div>
</template>
extendDashboard(nuxt, 'crew.home', …). Then its
items appear in the grid, with a small Customise dashboard icon button above them (on the hub, in the heading).Options
Options go under the dashboard key.
| Option | Type | Default | Purpose |
|---|---|---|---|
homeTab | object | false | { dashboard: 'crew.home', path: '/crew' } | The Home tab, with Mobile installed. false turns it off. |
homeTab.dashboard | string | 'crew.home' | The dashboard the tab draws. |
homeTab.path | string | '/crew' | The path of the tab's page. |
homeTab.label | string | 'Home' | The tab label. Without it the label is translated (dashboard.home.label). |
homeTab.icon | string | 'i-lucide-house' | The icon of the web tab bar. The native iOS tab uses the SF Symbol house. |
homeTab.items | string[] | every item | Only these items of the dashboard, by id and in this order. |
settings.pages.home | string | boolean | '/dashboard' | The hub's path. true is /dashboard, false turns the hub off. Needs Auth. |
settings.home.dashboard | string | 'home' | The dashboard the hub draws below its shortcuts. |
homeTab. With Mobile installed, Dashboard registers a page at path that draws the
dashboard, and adds the tab home with order: 0 and requiresAuth: true. A page of your own at the same path wins.
Without Mobile, nothing is registered.
The page draws the dashboard, then the dashboard.home widget area, where an app adds
sections of its own with extendWidgets(nuxt, 'dashboard.home', ...). Each item and widget gets homeTab: true as a
prop, so an item can render nothing there when it has nothing to say (as shifts.next does without a shift).
homeTab.items. For a short "what's next" Home while the rest of the dashboard lives in another tab, such as the
crew hub: homeTab: { items: ['shifts.next'] }. The tab then has no edit mode, and with none of the items to show it
shows nothing rather than an empty dashboard.
settings.pages. The resolved path is in useRuntimeConfig().public.dashboard.pages.home (unset when the hub is
off), and the hub's dashboard in useRuntimeConfig().public.dashboard.homeDashboard.
App
Your app draws dashboards with the components, or lays one out itself with useDashboard. Module authors add items
with extendDashboard.
Add items from a module
Call extendDashboard in your module's setup(), only when Dashboard is installed. The order between modules does not
matter.
import { createResolver, defineNuxtModule, hasNuxtModule } from '@nuxt/kit'
export default defineNuxtModule({
meta: { name: '@frigear-nu/shifts' },
async setup(_options, nuxt) {
const resolver = createResolver(import.meta.url)
if (hasNuxtModule('@frigear-nu/dashboard')) {
const { extendDashboard, extendHubDashboard } = await import('@frigear-nu/dashboard/utils')
const items = [{
id: 'shifts.next',
component: resolver.resolve('./runtime/app/dashboard/NextShift.vue'),
titleKey: 'shifts.dashboard.next',
title: 'Your next shift',
order: 10,
size: { cols: 2, minCols: 1, maxCols: 4 },
permission: 'shifts:read',
}]
extendDashboard(nuxt, 'crew.home', items)
// The same items on the signed-in hub, when there is one (see "The hub").
extendHubDashboard(nuxt, items, { except: 'crew.home' })
}
},
})
As for every soft dependency, also list @frigear-nu/dashboard as an optional module dependency:
moduleDependencies: { '@frigear-nu/dashboard': { version: '>=0.0.0', optional: true } }
An item is a Widget WidgetDefinition with five
more fields:
type DashboardItem = WidgetDefinition & {
title?: string // plain fallback title
titleKey?: string // i18n key, translated at render time
platforms?: ('web' | 'mobile')[] // default: both
optional?: boolean // often has nothing for this viewer: hidden until it has content
when?: { module?: string, platform?: 'web' | 'mobile' } // every key that is set must hold
}
idis unique within a dashboard. An item registered again under the sameidreplaces the earlier one, so your app can replace a module's item. Theiddefaults to the component's file name. Keep it at most 100 characters.permissionhides the item from viewers who lack it. Authorization does this through thewidgets:filterhook. The data behind the item is still checked on the server.platformsandwhen.platformpick where the item shows. The platform ismobileinside the native app of Mobile, andwebeverywhere else. The server always rendersweb: a server-rendered page (Mobile withspa: false) switches tomobileonce hydration is done.optionalis for an item that often has nothing for the viewer, such as Your apps. It shows no title or skeleton while it loads (not even in the server-rendered page) and joins the grid once it has rendered content, so it never appears only to vanish again. Once shown, it behaves like any other item.when.moduleships the item only when that module is installed. It is decided at build time, so the item's component is not even bundled otherwise.sizeis how much room the item would like:cols,minColsandmaxColsin columns of the four-column grid, androws. See Sizing.spanstill works as the old name ofsize.cols, and is deprecated.
extendDashboard, never with extendWidgets(nuxt, 'dashboard.<name>', …). A widget without the
dashboard part is not shown, and the build warns about it.authorize on the server for the data an item loads.The admin dashboard
With Admin installed, /admin draws the dashboard admin, with Customise dashboard
in its heading. Modules add to it with Admin's extendAdminDashboard, which gives each widget a default size from its
old position (Admin dashboard), or with extendDashboard(nuxt, 'admin', …).
Without Dashboard the same widgets go into Admin's three widget areas. Each staff member's layout is saved like any
other, under the name admin.
Write an item
An item is an ordinary Vue component. It receives its props, then every entry of the dashboard's context. Reuse
StatCard and ListCard from UI, or the building blocks below.
<script setup lang="ts">
import { useDashboardItem, useFetch, watchEffect } from '#imports'
const { loading, error, onRefresh } = useDashboardItem()
const { data, status, error: fetchError, refresh } = useFetch('/api/shifts/me/next', { lazy: true })
watchEffect(() => {
loading.value = status.value === 'pending'
error.value = fetchError.value
})
onRefresh(refresh)
</script>
<template>
<!-- No `label`: the dashboard shows the item's `title` above it. -->
<StatCard
:value="data?.startsAt"
icon="i-lucide-calendar-clock"
empty="No shift booked"
/>
</template>
The frame shows the item's title above the component, so the component shows no heading of its own (a StatCard
without label, a ListCard without title). A component that is also a widget of another area, where it needs its
heading, takes a framed prop and leaves the heading out when it is set; register the item with
props: { framed: true } (Help Center's onboarding summary, Admin's widgets).
useDashboardItem() returns the item's context. Outside a dashboard it returns local state, so the component still
works on a page of its own.
useDashboardItem(): {
dashboard: string
id: string
loading: Ref<boolean> // set it: the frame shows a skeleton instead of the item
error: Ref<unknown> // set it: the frame shows the error and a "Try again" button
empty: Ref<boolean> // set it: nothing to show this viewer, the item (title included) leaves the grid
collapsed: ComputedRef<boolean>
settings: ComputedRef<Record<string, unknown>> // the user's settings of this item
setSettings(value: Record<string, unknown>): Promise<void> // replaces them, `{}` clears them
refresh(): Promise<void> // clears `error` and calls the `onRefresh` handler
onRefresh(handler: () => unknown): void
}
An item that throws while rendering shows the same error state, without breaking the rest of the dashboard.
Set empty when the item has nothing for this viewer, such as no applications to open: the item takes no place in the
grid until it has something, and shows again (title only) while the user edits the layout. Prefer it to an empty card
for items that only make sense with data, and mark such an item optional so it does not flash while it loads. An item whose component renders nothing at all (a v-if on its root, as a
widget shared with another widget area may have) leaves the grid the same way, title included.
Components
| Component | Props | Purpose |
|---|---|---|
<Dashboard> | name: string, context?: Record<string, unknown>, editable?: boolean (default true), v-model:editing, editButton?: boolean (default true), items?: string[] (only these item ids, in this order), emptyState?: boolean (default true) | Draws the dashboard in DashboardGrid, with the edit mode. Slot empty, for a dashboard with no items (none hidden either). With :empty-state="false" such a dashboard renders nothing and takes no room (its root is hidden, with data-dashboard-empty), for a page with something else to show. With :edit-button="false" the page starts edit mode itself; the component's ref exposes canEdit and start(). |
<DashboardGrid> | none | Sized by the width it gets, not the screen (a container query): one column, two from 42rem, four from 56rem. Items in a row share its height. rows?: { 2?, 4? } sets the grid-template-rows of the two- and four-column grid (packRowTemplate); without it rows are as tall as their content. |
<DashboardItem> | item: DashboardEntry, context?, editing?, first?, last?, placements?: { 2?, 4? } | One item with its title, collapse toggle, skeleton and error state. Goes where placements says (packDashboard), else spans its own width in the grid's flow. Emits visible and, in edit mode, resize, moveUp, moveDown and hide. |
<ChartCard> | title, description?, loading?, isEmpty?, empty? | A frame for a chart in the default slot, with #actions. No chart library is bundled. |
<ActionCard> | title, description?, icon?, actionLabel, to?, loading? | A call to action with one primary button. Emits action. |
<EmptyCard> | title, description?, icon?, actionLabel?, to? | An empty state (UEmpty) with exactly one action. Emits action. |
- Edit mode. Customise dashboard (a small settings icon with a tooltip; on the hub it sits in the page heading) shows buttons to move each item up or down, to resize it and to hide it, and lists the hidden items with a button to show each again. Reset layout asks for confirmation, then restores the default. The buttons are disabled while a change is being saved. When changes are not saved for the user, edit mode says they last until a reload.
- Moving. An item moves within the full order of the dashboard, so items the viewer does not see (on the other
platform, or hidden by
widgets:filter) keep their place. - Loading. While the items load,
<Dashboard>shows a skeleton grid, never an empty dashboard. If they fail to load, it shows an error with a Try again button. dashboardSpanClass(span)(deprecated) returns the container-query classes of an item spanningspancolumns, for a grid of your own.DashboardItemno longer uses it.
Sizing
An item says how much room it would like with size. Widths are in columns of the four-column grid:
size?: {
cols?: 1 | 2 | 3 | 4 // preferred width; default `span`, else 1
minCols?: 1 | 2 | 3 | 4 // narrowest, to fit the rest of a row; default `cols` (never shrinks)
maxCols?: 1 | 2 | 3 | 4 // widest, to fill a row; default `cols`
rows?: 1 | 2 | 3 | 4 // height in rows; default 1
}
An item changes width only within the bounds it declares: without minCols and maxCols it keeps cols (so an old
span: 2 item looks as it did). A list that reads well at any width is { cols: 2, minCols: 1, maxCols: 4 }; a stat
is { cols: 1 }.
- Packing.
<Dashboard>places the shown items for the two- and four-column grid withpackDashboard, in the user's order (never reordered to fill a hole, so moving up and down stays predictable). An item goes to the next spot where it fits: narrower, down tominCols, when that is the room left in the row, else on the next row. Then the items of each row grow, in order, towardmaxColsinto the free cells to their right. Every width is clamped to the grid, so on two columns a four-column item is two wide. With one column the items flow in order. - Rows. From two columns, a row that holds an expanded item is at least 10rem tall and grows with its content, so
an item two rows tall sits beside two items one row tall. A collapsed item is one row tall, and a row of only
collapsed items is as tall as their titles.
packRowTemplate(placements, collapsed)gives thegrid-template-rows, which<Dashboard>passes to<DashboardGrid :rows>. - What takes a place. Only the items that show are packed: an
optionalitem that has nothing yet, or an item that isempty, leaves no hole. - Resizing. In edit mode, Narrower and Wider change the width one column at a time within
minColsandmaxCols(shown only when they differ), starting from the width the four-column grid shows. Shorter and Taller change the rows (1-4). Reset size returns the item to itssize. The user's size is saved in the layout (sizes) and wins oversize; a width the user chose is never shrunk or grown by the packing (only clamped on two columns). Reset layout clears every size. - Your own grid.
packDashboard(items, columns)andresolveItemSize(item, customSize?)from@frigear-nu/dashboard/utilsare plain functions;DashboardEntry.effectiveSizeis the size<Dashboard>packs.
Lay out a dashboard yourself
A page can draw the same items in its own layout. useDashboard(name, context?) returns them filtered by permission
and platform, in the user's order and without the hidden ones. Await it so they render on the server.
<script setup lang="ts">
const { items, hidden, move, hide, show, resize, reset } = await useDashboard('crew.home')
const featured = computed(() => items.value[0])
const others = computed(() => items.value.slice(1))
</script>
<template>
<div class="flex flex-col gap-4">
<PageHeading title="Home" />
<DashboardItem
v-if="featured"
:item="featured"
/>
<DashboardGrid>
<DashboardItem
v-for="item in others"
:key="item.id"
:item="item"
/>
</DashboardGrid>
</div>
</template>
useDashboard(name: string, context?: MaybeRefOrGetter<Record<string, unknown> | undefined>, options?: { only?: MaybeRefOrGetter<readonly string[] | undefined> }): {
items: ComputedRef<DashboardEntry[]> // shown items, in the user's order
hidden: ComputedRef<DashboardEntry[]>
collapsed: ComputedRef<string[]>
layout: ComputedRef<DashboardLayout>
persisted: ComputedRef<boolean> // whether changes are saved for the user
saving: Ref<boolean> // a change is being saved
platform: Ref<'web' | 'mobile'>
move(id: string, toIndex: number): Promise<void> // index among `items`
hide(id: string): Promise<void>
show(id: string): Promise<void>
toggleCollapsed(id: string): Promise<void>
resize(id: string, size: { cols?: number, rows?: number } | null): Promise<void> // `null`: back to the item's `size`
reset(): Promise<void>
status, error, refresh // of the underlying `useWidgets`
}
// The item's widget data and dashboard data, with `title` translated.
type DashboardEntry = WidgetMeta & {
title?: string, titleKey?: string, platforms?, when?, dashboard: string, collapsed: boolean
effectiveSize: { cols: number, minCols: number, maxCols: number, rows: number, fixed: boolean } // `size` plus the user's
customSize?: { cols?: number, rows?: number } // the user's size, if any
}
DashboardItem provides useDashboardItem() to the item, so items behave the same in your layout.
The hub
With Auth installed, Dashboard adds a page for signed-in users at settings.pages.home
(/dashboard). It shows a greeting with the user's first name, a compact row of shortcuts (an icon and a label for every
area in the dashboard menu other than the hub itself, four to a row on wide screens), and then the user's own
dashboard, <Dashboard :name="settings.home.dashboard">. With no shortcuts and no items it shows one empty state; with
shortcuts and no items, nothing below them.
- The area. Every page at
/dashboardand below gets thedashboardlayout (anappLayoutroute rule), unless the page chose a layout itself, and is for signed-in users only (guardPagesof Auth, enforced by Authorization; the build warns when it is missing). The Danish and other locale prefixes are covered too. - The layout.
dashboardwraps yourdefaultlayout (site header and footer) aroundAreaNavLayoutfrom UI: the user and thedashboardmenu in a sticky column on wide screens, a section switcher on narrow ones. Anapp/layouts/dashboard.vueof your own replaces it. - The menu. The navigation is the
dashboardmenu of Menu: the Overview (dashboard-overview, order0) and every area other modules add. Without Menu only the Overview is listed.useDashboardNav()returns the same entries for a layout of your own:items,links(forUNavigationMenu),shortcuts(without the Overview) andcurrent. Await it. - The account menu. A
dashboarditem (order-100) leads theaccount.dropdownmenu, above Account.
A module adds its area to the hub from its runtime/menus.ts, the same way it adds pages to the account area. The
permission of an item hides it from users who lack it:
import { defineMenuSource, extendMenuItem } from '@frigear-nu/menu/utils'
export default defineMenuSource(() => {
extendMenuItem('dashboard', {
id: 'crew',
label: 'Crew',
labelKey: 'crew.menu.home.label',
description: 'Your crew places, your shifts and swaps.',
icon: 'i-lucide-hand-heart',
to: '/dashboard/crew',
order: 20,
permission: 'crew:read',
})
})
Register the file with addOptionalMenuSource(nuxt, { file, menu: 'dashboard' }) from
@frigear-nu/module-kit/utils. Pages under /dashboard get the hub layout and guard without more work.
A module finds the hub's path in setup() with resolveDashboardHubPath(nuxt) of
Module Kit (undefined when there is none; pass { dependency: true } when the module
requires Dashboard and Auth), puts its default page below it, and redirects the old path with addPageRedirects(nuxt, { '/old': '/dashboard/new' }). The areas the modules add this way:
| Area | Module | Order |
|---|---|---|
/dashboard/crew, with the crew.dashboard tabs | Crew (tabs from Shifts) | 20 |
/dashboard/tickets (pages.tickets: true) | Events | 30 |
/dashboard/help | Help Center | 40 |
/dashboard/apps (pages.applications: true) | OAuth Server | 50 |
A module adds items to the hub's dashboard (settings.home.dashboard, home by default) with
extendHubDashboard(nuxt, items). It decides once every module is set up whether there is a hub (Dashboard and Auth
installed, settings.pages.home not false) and adds nothing otherwise, so the order of the modules does not matter.
A module that also adds the items to another dashboard passes that name as except, so nothing is added twice when the
hub draws that same dashboard. Layouts are saved per dashboard: a user arranges the hub apart from the crew home.
The personal items on the hub, in their default order:
| Item | Module | Order | Size |
|---|---|---|---|
oauth-server.apps (optional) | OAuth Server | 5 | 4, down to 2 |
crew.status | Crew | 10 | 2, down to 1 |
shifts.next, shifts.on-now | Shifts | 20, 30 | 2, down to 1 |
shifts.swaps | Shifts | 40 | 1, up to 2 |
operations.wristband (optional), operations.upcoming | Operations | 45, 50 | 1, up to 2 |
teams.mine | Teams | 60 | 2, down to 1 |
help-center.onboarding | Help Center | 70 | 2, down to 1 |
inbox.unassigned, inbox.mine (web) | Inbox | 80, 81 | 2, down to 1 |
Crew, Shifts, Teams, Help Center and Operations add the same items to crew.home, which the crew home's Overview tab
and the mobile Home tab draw; Inbox does when its settings.dashboard is left unset. At four columns every row fills,
whichever items a user has (they drop out when they have nothing to show).
The Home tab and the Crew tab
The Home tab opens /crew, the Crew tab of Crew opens the crew home in the hub
(/dashboard/crew), or /crew/status without the hub. A tab matches its page
and everything below it, but the tab bar selects only the most specific match, so Home is selected on /crew and Crew on
/crew/status, never both.
Per-user layout
Each user's layout is one Preferences key, dashboardLayouts. Dashboard registers it
with addUserPreferences when Preferences is installed, as a managed preference: it is never in the session cookie,
PATCH /api/preferences refuses it (400 preference_managed), and it is read and written only through Dashboard's own
routes. So a large layout never makes the session cookie too large to set.
type DashboardLayouts = Record<string, { // by dashboard name
order: string[] // the ids of the items the user moved; the others keep their registered place
hidden: string[]
collapsed: string[]
settings?: Record<string, Record<string, unknown>> // by item id
sizes?: Record<string, { cols?: number, rows?: number }> // by item id, each 1-4
}>
- Signed in with a cookie session, with Preferences: every change is saved. The layout follows the user to every
device. The app saves from a cookie session, so this needs Auth in server mode (the routes also take a token given
dashboard:layouts). - Without Preferences, signed out, or Auth in client mode (a Capacitor app, a bearer token): changes last for the session. After a reload the registered order applies. Session changes belong to one user: they are dropped when someone else signs in.
- Saving. One save runs at a time, and changes made meanwhile go out together in the next one. A save sends only the dashboards changed in this session; the server merges them into the stored ones. A failed save shows an error toast and rolls the dashboard back to the last saved layout.
- Moving an item stores only the ids whose place changed (
minimalOrder), so a dashboard with any number of items can be reordered. The order is worked out over every registered item (applyLayout(items, layout, all)), so items of the other platform or hidden by a permission keep their place. - A stored layout that no longer parses (a limit changed, a row edited by hand) is dropped when the layouts are read or saved, and never sent back, so it cannot make every later save fail.
- Ids that no longer exist are ignored, and dropped at the next save. An item a module adds later appears directly after the item registered before it.
The layout is bounded, as one JSON column of the user holds it:
| Limit | Value |
|---|---|
| Dashboards with a saved layout | 20 |
Ids in order, hidden or collapsed | 200 each |
| Length of an id | 100 characters |
| Item settings per dashboard, as JSON | 1 KB (UTF-8 bytes) |
| Item sizes per dashboard | 200 |
A save past a limit is rejected with 400 and rolled back. Keep item settings to a few small values.
Utils
@frigear-nu/dashboard/utils is safe to import in another module's setup(). It does not import @nuxt/kit.
| Export | Purpose |
|---|---|
extendDashboard(nuxt, name, items) | Adds one or more items to a dashboard, from a module's setup(). |
extendHubDashboard(nuxt, items, { except? }) | Adds items to the hub's dashboard when there is a hub, decided once every module is set up (The hub). |
resolveHubDashboardName(nuxt) | The dashboard the hub would draw (settings.home.dashboard, home by default), read from the app's options. It does not say whether there is a hub. |
dashboardArea(name) | The widget area of a dashboard: dashboard.<name>. |
applyLayout, orderItems, moveItem, minimalOrder, hideItem, showItem, toggleCollapsed, setItemSettings, setItemSize, pruneLayout, resetLayout | The layout logic useDashboard uses, as plain functions. |
packDashboard(items, columns), packRowTemplate(placements, collapsed), resolveItemSize(item, customSize?) | The grid packing <Dashboard> uses (Sizing). |
filterByPlatform(items, platform), isOnPlatform(item, platform) | The platform filter. |
Hooks
Items are filtered by Widget's widgets:filter app hook, with the area dashboard.<name>.
| Hook | Where | When | Payload |
|---|---|---|---|
dashboard:extend | Nuxt build | Once every module is set up, before the dashboards are read | extend(name, items), which adds items like extendDashboard, and { hub }, the hub's dashboard (unset without a hub). For a module that cannot import this package (Admin) and so adds items only when Dashboard is installed; extendHubDashboard uses it too. |
widgets:filter (Widget) | Nuxt app | Before a dashboard's items are drawn | { area: 'dashboard.<name>', widgets, context? } |
Routes
With Preferences installed, Dashboard registers the caller's own layouts. Path builders: dashboardApi from
@frigear-nu/dashboard/api.
| Method | Path | Access | What it does |
|---|---|---|---|
GET | /api/dashboard/me/layouts | dashboard:layouts | The caller's layouts, { layouts: { [dashboard]: DashboardLayout } }. A stored layout that no longer parses is left out. |
PATCH | /api/dashboard/me/layouts | dashboard:layouts | { layouts: { [dashboard]: DashboardLayout | null } } replaces the named layouts (null removes one) and keeps the others; answers like the GET. 400 past a limit. |
dashboard:layouts is implicit: every signed-in user holds it, and may give it to an API token or an OAuth access
token. Both routes only ever act on the caller. Without Auth, 401 unauthorized; a token without it,
403 insufficient_scope.
Translations
Override any string in your app's i18n/locales/<code>.json. The namespace is dashboard, in English and Danish.
| Key | Used for |
|---|---|
dashboard.home.label | The Home tab label |
dashboard.hub.title, .greeting, .description, .empty.* | The hub's heading ("Hi {name}", or "Your dashboard"), description and empty state |
dashboard.nav.label | The accessible name of the hub navigation |
dashboard.menu.dashboard.*, dashboard.menu.overview.* | The hub's items in account.dropdown and the dashboard menu |
dashboard.edit.start, .done, .sessionOnly | The edit mode buttons and the session-only hint |
dashboard.save.error | The toast when a layout change could not be saved |
dashboard.reset.button, .title, .description, .confirm | Reset layout and its confirmation |
dashboard.permissions.layouts, .layoutsDescription | The dashboard:layouts permission on consent and token screens |
dashboard.item.* | Collapse, move, resize and hide labels, and the error state of an item |
dashboard.hidden.title, .show | The list of hidden items in edit mode |
dashboard.empty.*, dashboard.allHidden.*, dashboard.error, dashboard.retry | The empty and error states |
Next steps
- Shifts – a module that adds three items to
crew.home. - Widget – the widget areas dashboards are built on.
- Preferences – where each user's layout is stored.