This guide explains how to compose Mastra application UIs from existing design-system components, use Tailwind for layout without overriding component styling, and select appropriate page and settings patterns. It also documents theme and stylesheet conventions, common review smells, and the requirement for explicit approval before changing the design system itself.
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Every Mastra application UI is assembled from the @mastra/playground-ui design system. Building a screen is composition work: pick existing components, arrange them with layout utilities, and let the design system provide the look. Writing colors, font sizes, shadows, or radii by hand means you have left the happy path. Changing the design system itself (tokens, ds/ components, variants) is a separate, explicitly-approved task. For Tailwind v4 mechanics (renames, dynamic utilities, CSS-first APIs), read the tailwind-v4 skill.
gap-*, margins, size constraints (w-*, max-w-*, min-h-*, shrink-0) — belongs to the consumer, through Tailwind utilities on your own wrappers and, when needed, directly on DS components.className on a DS component is fine for layout (<DialogContent size="xl" className="h-[80vh]">, where size picks the width and the class only pins the height) and forbidden for look (<Button className="bg-red-500 text-xs">). If a component's look doesn't fit, use its variants and props; if none fit, escalate for a new variant instead of overriding.
packages/playground-ui/src/ds/components/ (primitives) and src/domains/ (feature components). Check the exports and existing usage before building anything new.@theme blocks under packages/playground-ui/theme/ (colors, status, data-viz, surfaces, typography, scale, motion), all imported by packages/playground-ui/theme.css, which holds the semantic aliases. The namespace tells you the generated utility: --color-x → bg-x/text-x/border-x, --spacing-x → p-x/gap-x/h-x, --text-x → text-x, --shadow-x → shadow-x, --radius-x → rounded-x. Token names drift — confirm them in the file, never use them from memory.Pick the highest rung that fits; each step down needs a reason:
theme.css.min-w-100, size-6, grid-cols-15).bg-(--row-bg), text-(color:--agent-color-fg)).max-h-[calc(100dvh-3rem)]).theme.css variables are API: adding one generates utilities for every consumer. Never modify theme.css, its layers in packages/playground-ui/theme/, or packages/playground-ui/src/ds/tokens/*.ts without explicit approval. To request a token: document the use case, explain why a local CSS custom property is not enough, and wait for the design team.bg-(--var) — not a new @theme token.var(--color-surface4), getComputedStyle) — never resolveConfig or JS token imports for styling.packages/playground-ui/components.css is the design system's stylesheet uncompiled: theme.css, the dark variant (@custom-variant dark (&:is(.dark *))), custom utilities, base styles and keyframes. src/index.css is @import 'tailwindcss' plus that file, for the library build. An app with its own Tailwind build imports components.css and sources.css into its sheet instead of style.css.:root; html.light flips the semantic variables. Theming is automatic through semantic tokens — never write dark: color overrides on semantic tokens; reserve dark: for rare structural differences.cn() — exported from @mastra/playground-ui for consumers, src/lib/utils.ts inside the package. Its twMerge is extended with the DS scales (src/lib/tw-merge-config.ts), so DS utilities like text-body-sm merge correctly; importing twMerge from tailwind-merge directly mis-merges them.packages/playground-ui outside ds/ (for example src/domains/) is itself a consumer of the ds/ primitives — all of these rules apply there too.Every page renders inside one PageLayout, and its variant sets the width, gutter, scrolling and way back. Pick the variant by what the page is for:
variant="form": a create or edit form. A 640px column under a title and one way back: a back link (backHref + backLabel), or breadcrumbs for a multi-step create flow such as onboarding. aside adds a live preview beside the form, or a step list with asidePlacement="start".variant="settings": a settings page someone browses to and changes in place. Breadcrumbs and a title over a 640px column of SettingsGroups.variant="page": everything else (lists, dashboards, detail pages, explorers). Full width, up to 1536px. Add body="fixed" when the body is panels that scroll on their own (chat, board, editor, graph, dataset panels).Each variant accepts only its own props, so a wrong combination doesn't compile. Never center a max-w-* column on a page yourself: the playground-ui/no-page-width lint rule flags it.
Settings cards (@mastra/playground-ui/new/settings) hold two kinds of rows. Pick by what the row is, not by how it looks:
SettingsRow (or SettingsFieldsetRow for a group of controls): a setting the person changes. Label, optional one-line description, and the control that changes it (input, select, switch, segmented control). It is a form field: the label names the control. A setting someone may not change keeps SettingsRow with viewOnly.SettingsItem: one thing in a list (an account, member, session, API key, connection, repository, a package version). Title, optional media and one-line description, and its status or per-item actions (Remove, Revoke, Copy) on the right. Lists usually come from a .map and start with a SettingsListHeader; an empty list is one SettingsEmptyRow.A row that only shows a value, status or per-item actions is a SettingsItem, and so is each record of a list (accounts, keys, versions) even when it comes from a .map. A .map over settings (one switch per tool) still renders SettingsRows: what matters is whether the row's control changes a setting.
bg-*, text color or size, border color, rounded-*, shadow-*, or padding via classNameds/ or domains/ componentSpinner as one: a page that hasn't shown yet loads with <BrandLoader fill />, the window with fill="screen". Dialogs, panels, cards and anything else inside a page that already shows keep Spinner or a skeletonSettingsRow per list entry or read-only value (versions, members, keys), or a SettingsItem wrapping a control that changes a setting: see "Settings pages" abovebg-[#hex], text-[15px], p-[13px] — a token or scale value existstheme.css (guessed from memory)bg-[var(--x)] — use bg-(--x)min-w-[400px] and friends that divide cleanly by 4px — use the scale (min-w-100)`bg-${tone}-500`) — map props to complete strings--color-* or --animate-* token added for one component's local statedark: color overrides on semantic tokens — the palette already flips via html.lighttwMerge imported from tailwind-merge or manual string concatenation instead of cn()motion-safe:/motion-reduce:font-mono class anywhere outside packages/playground-ui/src/ds (lint rejects it): use <Txt font="mono"> for identifiers, timestamps, and durations, InlineCode or CodeBlock for code, tabular-nums for numbers. <pre> and <code> are already monotabular-nums. KPI values, chart axes, and chart tooltips stay in the body face even for time, so dashboards read in one face. See the Typography section of packages/playground-ui/README.md<code className="rounded bg-…">: use InlineCode in a sentence and a highlighted CodeBlock (with lang) for anything longeraria-label ("Add Persistent Server"): actions use sentence case ("Add persistent server", "Open in Studio"). Capitalize only the first word and proper nouns: brands and products (Mastra, Studio, GitHub, MCP) and plan names ("Upgrade to Team"). Feature names are lowercase ("Edit working memory"). Lint (mastra/sentence-case-labels) catches static text; labels built in variables, props, or default values need the same careplayground-ui/placeholder-text) checks string placeholder and *Placeholder valuesmastra-ai/mastra
7f5453c
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.