--- name: softr-vibe-coding description: >- Build, fix and run Softr apps and client portals, with custom Softr Vibe Coding blocks at the core: React (TSX) components on a Softr page, wired to any Softr data source. Use for any work on a Softr app: a list, form, dashboard, chart, detail page or hero block; a block that renders empty, crashes or loses Action permissions after a push; code with useRecords, q.select or @/lib/datasource; pushing a block, or making apps, pages, users, databases or workflows, with the Softr MCP; native block settings in Studio; Custom Code CSS for Softr's header, sidebar or footer; QA of a Softr app before go-live. Not for vibe coding in general or the same UI outside Softr: charts go to dataviz, React pages to artifact-design or plain code. Not for Airtable scripts or formulas (airtable-automation), website copy about Softr (flow-digital-voice-copywriting), or brand tokens with no Softr app (run dembrandt directly). effort: max allowed-tools: Read Write Glob Grep Bash --- # Softr Vibe Coding Block Generator You generate complete, production-ready Softr Vibe Coding blocks as TypeScript React files. A Vibe Coding block is a single file with a default-exported React component, compiled by Softr's server and run in the browser inside a Softr app. The current platform compiles TypeScript with modern syntax — optional chaining (`?.`), nullish coalescing (`??`), arrow functions, `const`, generics — plus shadcn/ui from `@/components/ui/*`, lucide-react, sonner, and date-fns (verified live against the builder MCP's `vibe_coding_block_get_docs` and a 15-block production deployment, 2026-08-25). > **Scope note — blocks vs. native chrome.** A block is page *content*, rendered inside a shadow DOM. Softr's global **header / top bar / sidebar / phone tab bar / nav / dropdown menus** are native chrome (configured in Studio, rendered in the main document) — you **cannot** build or replace them as a block. To restyle them, or to paint them into one app frame around the content, add CSS to Settings → Custom Code → Code inside header. See [references/native-chrome-styling.md](references/native-chrome-styling.md) (app frame: [App frame (navigation layout)](references/native-chrome-styling.md#app-frame-navigation-layout); the blocks that sit inside it: [App pages beside Softr navigation](#app-pages-beside-softr-navigation)). One nuance: on a landing page where the native header is **hidden**, a hero block CAN render its own fixed in-block header (`position: fixed` inside the shadow root anchors to the viewport — verified 2026-08-31 from Softr's own Studio-AI output); pattern + caveats in [references/static-blocks.md](references/static-blocks.md#block-owned-landing-page-header). > **Scope note: Softr work with no block.** When no block or Custom Code is involved (creating or changing apps, pages, navigation, users, databases or workflows over the Softr MCP, or a native block's settings in Studio), skip the workflow below, including the DESIGN.md step. Read [references/softr-mcp.md](references/softr-mcp.md) for the task, next to the Softr connector's own guides (`application_read_guide`, `workflow_guide`). Airtable scripts and formulas belong to the `airtable-automation` skill when it is installed (else [references/airtable-automations.md](references/airtable-automations.md)). Website copy about Softr is not this skill's job. ## Your Workflow 1. **Detect the brand source (always run first, before any new block).** Check if a `./DESIGN.md` file exists in the project folder you're about to work in. A fix to an existing block keeps the colors and fonts the block already has: skip this step unless the user asks for a restyle. - **If `./DESIGN.md` is found:** Read its frontmatter and confirm with the user: > "I found a DESIGN.md in this project (brand: ``, extracted from: ``). Use its brand tokens for this block? > 1. Yes — use this DESIGN.md > 2. No — use the default Softr style instead > 3. No — I'll paste a different brand override" (Filling the placeholders: in a dembrandt-generated file, `` is the frontmatter `name:` and the source URL sits inside `description:`; legacy files carry `brand:`/`source:`/`extracted:` instead. On request, a stale DESIGN.md can also be regenerated with dembrandt — that overwrites `./DESIGN.md`, and legacy scaffolding sections like `Application Patterns`/`tech_stack` are not reproduced.) If (1), load every token section present: `colors`, `typography`, `spacing`, `rounded`, `components` from the YAML frontmatter, plus the body's Layout / Elevation & Depth / Shapes evidence and the Typography section's **Font URLs** (the frontmatter `fontFamily` can name a generic fallback like `ui-sans-serif` while the Font URLs reveal the real brand font — cross-check before picking the font). Sections without extracted evidence are simply absent — don't invent defaults for them. Files from the `building-design-md` companion (v2+) and legacy pre-dembrandt files may carry extra sections — a `fonts` block (the resolved brand fonts — prefer it over computed `fontFamily` values), an `Application Patterns` scaffold, a `tech_stack` block, or legacy `elevation` — honour those when present (the `tech_stack` block may pin specific shadcn variants or note bundler quirks). Full format anatomy: [references/dembrandt.md](references/dembrandt.md#designmd-anatomy-what-step-1-reads). If (2), proceed with the default Softr style (see Step 3). If (3), accept the override and apply it. - **If `./DESIGN.md` is NOT found:** Tell the user: > "No DESIGN.md found in this project. Three options: > A. **Generate one now with dembrandt** — give me the brand's website URL and I'll extract its design system (real-browser crawl: colors, typography, spacing, components) into `./DESIGN.md`, then build on those tokens. (Recommended for client work.) > B. **Quick brand override** — paste the brand's primary color, accent color, and font name now. I'll apply just those. > C. **Use the default Softr style** — primary `#386AF5`, accent `#FCB500`, Inter font." Wait for their pick. If (A) — extracting only a site the user owns or has permission to analyze (a contracted client's own site qualifies) — run the dembrandt pipeline from [references/dembrandt.md](references/dembrandt.md) in this same session — via the dembrandt MCP server when connected (`get_design_tokens` with `pages: 3`–`5` → poll `get_job_status` → `get_findings` sanity check → `generate_design_md`, then **write the returned markdown to `./DESIGN.md` in the project root**), or the CLI fallback when not (`npx -y dembrandt@latest --design-md --crawl 5`, then copy `output//DESIGN.md` to `./DESIGN.md`). If neither is available, give the user the install commands from that reference and pause until dembrandt is set up (an MCP server added now connects next session — the CLI is the same-session path). Show the user the extracted brand summary, then continue to Step 2 with those tokens. (When the project deserves a fuller foundation — voice & copy register, logo assets, app-pattern scaffolds, the `custom-code-header.html` snippet — offer the `building-design-md` skill (v2+, same dembrandt engine plus those layers) instead of this quick raw generation.) No public website to extract? Use (B), or offer to hand-author `./DESIGN.md` from whatever brand material the user has (a brand guide PDF, a style sheet) — Step 1 honours any DESIGN.md with token sections, not only dembrandt-generated ones. If (B) or (C), record their choice for Step 3 and continue. Do not silently default to Softr's brand. The user must opt in to defaults explicitly. 2. **Understand what the user wants to build — and fork on archetype.** They will describe it in plain language. First decide: is this a **data-connected block** (list, dashboard, form, detail page — reads or writes records) or a **static marketing block** (hero, page header, pricing table, testimonial band, footer, content section — zero datasources, all content from editable settings)? For static blocks, read [references/static-blocks.md](references/static-blocks.md) and **skip the data-source questions and datasource guides entirely** (Step 1 brand detection still runs); settings-first design becomes the default — see [references/editable-settings.md](references/editable-settings.md#granularity-doctrine-settings-first-static-blocks). For data blocks, only ask about things you genuinely cannot infer: **data source type** and **field IDs**. For everything else, make sensible defaults and flag your assumptions. 3. **Apply defaults for the rest, don't ask.** Infer these from context instead of asking: - **Project folder**: Derive from the block description (e.g., "partner-portal", "client-dashboard"). If the user has already specified a folder in this session, reuse it. - **Brand colors**: Use whatever was chosen in Step 1 — DESIGN.md tokens, the user's override, or the default Softr palette (primary `#386AF5`, accent `#FCB500`). Never silently fall back to defaults. - **Filename**: Derive from the block purpose (e.g., `partner-invite.tsx`, `team-directory.tsx`). The user can rename later. 4. **Load the relevant data source guide** from [datasources/](datasources/) before writing code. Read the specific guide for the user's data source type. (Static marketing blocks: skip this step — read [references/static-blocks.md](references/static-blocks.md) instead.) 5. **Write the complete block file** (`.tsx` preferred; `.jsx` also compiles) to the project sub-folder and tell the user the full path. Create the sub-folder if it doesn't exist yet. The file must be fully self-contained, **visually polished from the first version**, and ready to paste into Softr's Vibe Coding editor. Styling is not an afterthought -- it ships in v1. **Never deliver code inline in chat.** Copy-pasting JSX from chat corrupts characters (`>`, `>=`, `=>`, quotes), causing compilation errors that are hard to debug. Always write to a file. **Delivery path:** if the official Softr MCP server is connected with Applications & Forms full access, offer to deploy the block directly after writing the file — `vibe_coding_block_create` (or `vibe_coding_block_update_code` for edits) plus `vibe_coding_block_connect_data_source` to wire the data. The local `.tsx` file stays the source of truth. Remember: every code push resets the block's Action permissions to defaults (Hard Constraint 21), and a block whose data source isn't connected saves fine but errors at page load. Details in [references/softr-mcp.md](references/softr-mcp.md). 6. **Self-validate before delivering.** Before presenting the code as complete, verify. (Data-hook items apply only to data-connected blocks; static marketing blocks swap in the checklist deltas from [references/static-blocks.md](references/static-blocks.md#workflow-deltas).) - Every data hook is called with an **inline options object literal** — `useRecords({ ... })` written through a variable or wrapper function fails to compile (verified live 2026-08-25). Share `q.select` mappings between hooks, never whole options objects - Multi-datasource block: every `select:` / `fields:` value is a **plain module-scope identifier** — no ternary, no inline `q.select({...})` inside the hook options (the query returns `fields: {}`; Hard Constraint 24) - Detail page: the record is fetched with `useRecord({ select, recordId, enabled: !!recordId })` using `useCurrentRecordId()`, and the code checks `data.id === recordId` before rendering — never `useRecords({ count: 1 })`, which returns the table's FIRST row (Hard Constraint 25) - No list query relies on `enabled: false` — `useRecords` fetches anyway; conditional list queries live in a child component mounted only when needed, or carry a match-nothing `where` (Hard Constraint 26) - Every alias a hook's `where` / `orderBy` names is in **that hook's own** `select` — anything else crashes the block at runtime (Hard Constraint 29) - Every `where` has been **seen to narrow** the result (compare row counts with and without it) — a filter on a field outside the connection's read-select union is silently ignored and returns everything ([datasources/reading.md](datasources/reading.md#filters-fail-open)) - Role checks read `window.__softr_current_user.userGroups` from state with a bounded poll, and role-dependent UI waits until it settles — the global has no change event and an early `[]` means not loaded yet ([datasources/reading.md](datasources/reading.md#current-user)) - Date-only values go through `toLocalDate()`, never `new Date()` or date-fns `parseISO()` — both read the stored midnight-UTC value as an instant, so it renders a day early west of Greenwich ([datasources/fields.md](datasources/fields.md#date-only-fields-arrive-as-midnight-utc)). A "today" that a save writes is `format(new Date(), "yyyy-MM-dd")` worked out in the click handler: never `toISOString().slice(0, 10)` (the UTC day), never a value computed at render or mount (stale on a page left open past midnight). A "Generated" stamp in an export or printout is local time with its UTC offset ([writing.md → Date](datasources/writing.md#date)) - A blank NUMBER (`null` in a block) shows blank, never `0`, and a stored `0` still shows `0`. A typed quantity is never silently changed: refuse what the input cannot read (`validity.badInput`, or a raw string that is not `^\d+$` for whole numbers) and parse with `Number`, never `parseInt` or `Math.floor` ([ui-ux-guidelines.md §11](ui-ux-guidelines.md#11-forms-and-input-fields) for typed input, [fields.md](datasources/fields.md#getfieldvalue----never-render-raw-fields) for stored values) - Every count goes through one `plural(n, one, many)` helper, so no "1 items" is left anywhere in the block: scan template literals, a JSX space before a noun, and a bare noun after a number formatter ([ui-ux-guidelines.md §22](ui-ux-guidelines.md#22-ux-writing-microcopy)) - No field is "hidden" from some viewers by a conditional / second `select` on the same connection — the browser receives the union of every read select on that connection (Hard Constraint 23). A connection that only creates (a public form) still answers its records endpoint with the row count and every record id: give it a Source condition that matches nothing ([softr-mcp.md](references/softr-mcp.md#a-create-only-connection-on-a-public-block)) - All imports use named imports (no `import React from 'react'`) - `export default function Block()` is present - Container + content wrappers present (`
`) — OR a deliberate full-bleed layout recorded in the `// BLOCK PLACEMENT:` comment (see "Block Placement & Page Spacing") - `// BLOCK PLACEMENT:` comment present at top of file with wrapper classes matching the placement (see "Block Placement & Page Spacing") - App page beside Softr's sidebar / top-bar navigation (the header code paints the frame): the block is **full-bleed** with **no background of its own** and no gradient/rounded page panel; every layout threshold is a container query on the block's width (`@container` on a wrapper + `@min-[NNrem]:`), with **no `sm:`/`md:`/`lg:` for layout**; sticky elements clear the top bar with `calc(var(--nav-height, 0px) + …)`. See [App pages beside Softr navigation](#app-pages-beside-softr-navigation) - Loading, error, and empty states all handled. Try again re-reads every read that is in error, not only the main list. A figure built from several reads shows the error if any of them failed, never a number from the rest. A failed read never falls through to the empty state ("No records yet"). An action that needs a complete list (a create with a duplicate check, an export) stays disabled until that read has fully loaded, and no list is cut off silently. The empty message of a list narrowed in the browser waits for every page of its read too ([reading.md](datasources/reading.md#loading-all-records-auto-pagination)). A control that finishes a half-saved action fails open: it shows unless the read has fully settled and found nothing to repair ([ui-ux-guidelines.md §12](ui-ux-guidelines.md#12-loading-states)) - Mutation calls gated behind `enabled` check (if using mutations) - Field access uses `record.fields.alias` (not `record.alias`) - Every field rendered in JSX wrapped in `getFieldValue()` -- prevents React error #31 - All hooks declared before any conditional `return` -- prevents React error #310 - Sub-components (FieldLabel, TextInput, ChipButton, SectionCard, etc.) defined at **module scope**, NOT inside `Block()` -- prevents inputs losing focus after one keystroke (each render creates a new component identity, React unmounts/remounts the ``). Keep `Block()` itself small too (one app's QA pass kept it under about 30,000 B, a working budget, not a known Softr limit) by moving dialog state, write queues, row memos and effects into module-scope hooks and functions, and leave each `hook.mutateAsync(...)` call on the hook variable where the hook is declared ([writing.md](datasources/writing.md#actions-register-per-table-not-per-hook-or-connection)) - When a custom DESIGN.md is in use, brand `fontFamily` (and any non-inherited brand defaults) set as an **inline style on the block's outermost wrapper** `
`, not relied on from `custom-code-header.html` -- Vibe Coding blocks render inside a shadow DOM and `html, body` rules don't cross that boundary. Per-element overrides (e.g. Fraunces serif on h1) still set inline at the element. - `fetchNextPage` never called in the render body — only from an event handler (Load More `onClick` with `disabled={isFetching}`, the official pattern) or a guarded `useEffect` (auto-load-all) - Mutations use `recordId` (not `id`) and call `refetch()` in `onSuccess` — no read follows a write otherwise (measured 2026-10-05 on a HubSpot-backed block). When the source changes other fields itself (HubSpot stamps a closing deal's close date and recalculates its probability a few seconds later), also read again a few seconds later — see [writing.md → Fields the source changes after the write](datasources/writing.md#fields-the-source-changes-after-the-write) - `useRecordUpdate` payload is `{ recordId, fields: { ... } }` — nested. `useRecordCreate` payload is **flat** (no `fields` wrapper). The two shapes are asymmetric by design (verified live 2026-08-25) - Sequential multi-row saves use `await hook.mutateAsync(...)` per row, in order, with stop-on-failure + retry state — `mutateAsync` is fully supported on the current platform (verified 2026-08-25; the old ".mutate() only" Action-parser rule is gone — see [datasources/writing.md](datasources/writing.md)). Row-level edits that can overlap (a picker or a Save on every row of a table) use `.mutateAsync(...).then(ok, err)` with a pending flag per record id, because callbacks passed to `.mutate()` belong to the latest call only ([writing.md → Overlapping writes on one hook](datasources/writing.md#overlapping-writes-on-one-hook)). Independent writes to **different tables** may run in parallel via `Promise.all`; drag/reassign UIs should be optimistic with an Undo toast — see [writing.md → Parallel writes across tables](datasources/writing.md#parallel-writes-across-tables-the-one-sanctioned-parallelism) - A failed save shows its error inside the dialog or panel where it happened (`role="alert"`), not only in a toast. A dialog can be closed whenever nothing is in flight, keeping what was typed. After a failed step the form stays locked until Retry or Start over, so a Retry always sends what the screen shows. The double-submit guard is a ref set before the first `await` ([writing.md → Sequential Multi-Row Writes](datasources/writing.md#sequential-multi-row-writes-mutateasync)). Focus never falls to `` when a Retry unmounts as the retry starts, or when its target is natively `disabled` ([common-patterns.md](references/common-patterns.md#failures-focus-and-escape)) - A form block calls `useNavigationBlocker(isDirty)` itself: a `beforeunload` listener alone misses Softr's in-app links. Confirm it in the preview: make the form dirty, click a sidebar link, expect the prompt ([common-patterns.md](references/common-patterns.md#navigation-blocker-for-unsaved-changes)). One dirty function drives both this guard and the Discard strip inside the form's dialog ([ui-ux-guidelines.md §15](ui-ux-guidelines.md#15-error-prevention-and-destructive-actions)) - No hardcoded domains in links -- use relative paths (`/page?recordId=...`); same-page anchors written relative too (`/#section`) - **No ``** — both break inside a block's shadow DOM (native hands the list to the OS; shadcn portals outside the shadow root and arrives unstyled). Use the `Combo` pattern in [references/searchable-dropdown.md](references/searchable-dropdown.md) — **searchable by default** for every framed filter or form field whatever the option count; `bare` inline editors are click-only; `searchable={false}` only on a short fixed enum the user is setting (a status, a location, a group-by). Opening a Combo moves focus into it (the search box, or the trigger on a click-only list), because Safari does not focus a clicked button. Escape on an open list closes only the list ([Move focus into the Combo when it opens](references/searchable-dropdown.md#move-focus-into-the-combo-when-it-opens)); inside a shadcn `Dialog` the dialog also needs an `onEscapeKeyDown` guard and an `onCloseAutoFocus` that returns focus to the opener ([common-patterns.md → Failures, focus and Escape](references/common-patterns.md#failures-focus-and-escape)) - **No native date field** — no ``, `type="datetime-local"` or `type="month"` in a branded block: the browser draws its calendar pop-up, and no CSS reaches it. Use the module-scope `DatePicker` kit in [references/date-picker.md](references/date-picker.md), pasted verbatim between its marker lines (block-specific code, `textClass` included, stays outside them). Values stay `"yyyy-MM-dd"` strings, compared as strings. Same rules as the Combo: nothing between the field and its scroller clips, and Escape on an open calendar closes only the calendar - App page with Softr navigation: **no shadcn `` / ``** — its overlay is z-50, under Softr's top bar (z-index 800), and it portals out of the shadow root. Use the in-block modal (`fixed inset-0 z-[1000]`, rendered as a sibling of the block's `@container` wrapper, with its own Escape, focus trap, scroll lock and focus return) in [references/common-patterns.md → A modal above Softr's bars](references/common-patterns.md#a-modal-above-softrs-bars) (measured live 2026-10-06); on a page opened in a Softr Modal, no overlay of the block's own: Softr's dialog is the frame ([references/modal-pages.md](references/modal-pages.md)) - No clipping class (`overflow-hidden`, `overflow-*-auto`, `truncate`, `line-clamp-*`) on any element that contains a `Combo` — its panel is `position: fixed` in local DOM, so a clipped cell no longer cuts the menu (it still clips the trigger); place it against its containing block (a dialog's `translate` counts) with `comboFixedBase` and `comboPlacement`, close it on scroll and resize, bound an over-wide chip at the chip (`min-w-0 truncate`), and never `scrollIntoView` inside the panel. See [references/searchable-dropdown.md](references/searchable-dropdown.md#the-four-things-that-will-bite-you), item 4 - **A signature is drawn in a popup and uploaded as a PNG** [house]: an Add signature button opens the in-block modal (not shadcn `Dialog`), the strokes stay local until Save signature, and on Send only the checked path is drawn on an off-screen white canvas, made into a PNG and sent with `useUpload` (a time limit, the create carries `{ filename, url }` into an ATTACHMENT field). The path is kept as text in the same create and a failed upload never stops the send; "Type the name instead" is a fallback link, not the main way; a stored path is read back by a linear tokenizer and rendered only from the parsed numbers ([common-patterns.md → Signatures: draw in a popup, upload a PNG](references/common-patterns.md#signatures-draw-in-a-popup-upload-a-png), measured live 2026-10-23) - Any **Print** control opens a **new window with its own document** — `window.open` straight from the click, an escaped standalone HTML printout written into it, `print()` once its stylesheets, fonts and images are in, the button disabled until the data has fully loaded. No `window.print()` on the Softr page, no in-page print view (Hard Constraint 28). See [references/printing.md](references/printing.md) - Static block: no hardcoded user-visible copy — every string/image/link is an editable setting (see [references/editable-settings.md](references/editable-settings.md#granularity-doctrine-settings-first-static-blocks)) - Array-setting rows keyed by **index**, never by a builder-editable field value - Media settings that may start empty (`src: ""`) gated with a conditional render or placeholder — never an unconditional `` - **Before the first push:** call `application_get` on the app and `workspace_list` — a connector can read as connected while signed in to another Softr account ([softr-mcp.md → Permissions model](references/softr-mcp.md#permissions-model)). A new block is created, pushed, given its id and mirrored by one job ([softr-mcp.md](references/softr-mcp.md#vibe-coding-block-tools)). A large search-replace plan is cut into calls by one tested script, and the exact ops bytes are replayed ([softr-mcp.md](references/softr-mcp.md#which-edit-tool-full-replace-vs-targeted-search-replace)). A page made over the MCP is logged-in-only; make it public with `application_page_set_permissions` and read it back ([softr-mcp.md](references/softr-mcp.md#pages-permissions-and-deleting)); its nav item goes over MCP with `application_navigation_set_items`, every existing item sent back as `{ id }` ([softr-mcp.md → Navigation](references/softr-mcp.md#navigation-menus-and-their-items)) - **Deploying through the MCP:** `errors: null` on a push is not proof — compare the push result's `sourceSha256` with `shasum -a 256` of the file you sent, every byte counted, trailing newline included (Softr stores exactly the text that reaches it; the one-byte drift we once blamed on it was a chunked read on our side). No `\uXXXX` escapes in pushed source: they arrive decoded to the characters and the hashes differ, so write the characters themselves (with a comment saying why) or build them from code points (`String.fromCharCode(0x300)`); lone surrogates are the exception ([why](references/softr-mcp.md#unicode-escapes-come-back-decoded)). Prove deployed == disk *before* editing the same way, with `vibe_coding_block_get_code` and `includeCode: false`, so a Studio-side change is never overwritten. Fetch the full `sourceCode` only when a digest is missing or the hashes differ. Protocol in [references/softr-mcp.md → Verifying a push](references/softr-mcp.md#verifying-a-push--the-deployed-source-is-the-only-proof) - **Then check it in a browser.** Once the push checks pass, check rendering and behaviour in a fresh preview with saves blocked, in the client's time zone (a check east of UTC misses date-only values that users west of it see a day early), per [references/browser-checks.md](references/browser-checks.md); for a whole QA pass (roles, logged-out access, figures against the database, forced failures, a live write pass) follow [references/qa-playbook.md](references/qa-playbook.md) ## What to Clarify When the user describes their block, figure out which of these areas apply and ask about anything you're missing: - **Data source type**: Is it Airtable, Softr Database, REST API, or another source? This determines the data fetching approach. **Load the relevant data source guide** from the [datasources/](datasources/) directory before writing code. - **Data source fields**: For Airtable/Softr Database, you need actual field IDs. For REST APIs, you access the raw API response directly. If the user doesn't know field IDs: - For **Softr Database**, the cleanest path is the official **Softr MCP server** — ask whether they have it installed (`claude mcp list` shows it as `softr` or similar). If yes, query schema directly with the MCP tools instead of asking for paste-ins. The same server also browses connected integrations down to field level — **Airtable, Google Sheets, Notion, Supabase**, and per its tool descriptions (2026-10-01) many more, from Excel and monday to HubSpot and SQL databases (`integration_list` → ... → `integration_list_table_fields`) — so prefer it for those sources too when available — see [references/softr-mcp.md](references/softr-mcp.md). If no MCP, the next-best option for Softr DB is the bundled **`get-softr-database` CLI script** — tell the user to run `python3 ~/.claude/skills/softr-vibe-coding/tools/get-softr-database.py ` (it prompts for their Softr API key and exports the full schema to `~/Desktop/softr-database--.json` — Python stdlib only, nothing to install) and paste the resulting JSON into chat. As a final fallback, ask them to paste the `tablespace-with-tables` network response (DevTools -> Network -> filter that string while on Studio's Data tab) — same JSON content, different acquisition path. Optionally tell them they can install the MCP once with `claude mcp add --transport http softr https://mcp.softr.io/mcp` for future sessions. Full MCP details in [references/softr-mcp.md](references/softr-mcp.md); CLI script details in [datasources/softr-database.md](datasources/softr-database.md#bundled-cli-script-get-softr-database); fallback paste-in workflows in [datasources/fields.md](datasources/fields.md#field-inspector-block). - For **Airtable**, the most thorough path is the bundled **`get-airtable-base` shell script** — `bash ~/.claude/skills/softr-vibe-coding/tools/get-airtable-base` (requires `jq` — `brew install jq` on macOS). It prompts for Base ID + PAT, then exports the full schema (every table, every field with both `fld...` IDs and column names, relationships, webhooks, interfaces) to a timestamped Desktop folder. The user pastes `02-schema.json` or the combined `00-bundle.json` into chat. For lighter inspection (just a few fields, runtime-only), suggest the Field Inspector block — empty `q.select({})` works for Airtable. CLI script details in [datasources/airtable.md](datasources/airtable.md#bundled-cli-script-get-airtable-base). - For other non-Softr-DB sources where empty `q.select({})` works, suggest the Field Inspector block. - **Brand colors**: Already resolved in Step 1 (Detect the brand source). Don't re-ask. The brand source is one of: - **Project's `./DESIGN.md`** (recommended for client work — generated by dembrandt in Step 1, or already present in the project; see [references/dembrandt.md](references/dembrandt.md)) - **User's quick override** (paste of primary + accent + font) - **Default Softr palette** (only when the user explicitly opted in — never as a silent fallback): | Color | Hex | Name | Use | |---|---|---|---| | Primary | `#386AF5` | Mariner (blue) | CTAs, links, active states | | Accent | `#FCB500` | Yellow Sea | Highlights, badges, sparkle accents | | Destructive | `#F53878` | Cabaret (pink) | Errors, destructive actions, required markers | | Text | `#030712` | Revolver (near-black) | Body text, headings | | Background | `#FFFFFF` | White | Page and card backgrounds | Softr logo assets (for blocks that need Softr branding): - Icon + wordmark (SVG): `https://cdn.brandfetch.io/idytCFzVcY/theme/dark/logo.svg` - Icon only (PNG): `https://cdn.brandfetch.io/idytCFzVcY/w/1024/h/1024/theme/dark/icon.png` - **Layout and style**: Cards vs. table vs. list? How many columns? Apply the Premium Visual Baseline for app-UI blocks; static marketing blocks use the editorial baseline in [references/static-blocks.md](references/static-blocks.md#editorial-baseline-replaces-the-premium-visual-baseline) instead. - **Navigation layout**: Does the app use Softr's **sidebar / top-bar navigation**, and where does the menu live — in the sidebar or in the top bar? Does the app's header code paint an app frame ([native-chrome-styling.md → App frame (navigation layout)](references/native-chrome-styling.md#app-frame-navigation-layout)), or should it? Beside a sidebar, an app page is full-bleed and lays out by its own width — see [App pages beside Softr navigation](#app-pages-beside-softr-navigation). With the menu in the top bar, the sidebar renders as an empty column in the theme colour (seen 2026-10-05); moving the menu into the sidebar is a Studio change, or `application_navigation_set_layout` over MCP (both untested; [softr-mcp.md → Navigation](references/softr-mcp.md#navigation-menus-and-their-items)). - **Interactivity**: Create/edit/delete? Filtering? Sorting? Pagination? - **User context**: Does it need to know who's logged in? - **Settings**: Should anything be editable by the Softr builder (titles, images, toggle sections)? Don't over-ask. If the user gives a clear description, fill in sensible defaults and note your assumptions. ## Examples (Decision Traces) **User:** "Build a team directory with cards showing name, role, and photo from Airtable" **Claude:** Reads `datasources/airtable.md` -> uses `q.select()` with Airtable column names (e.g., `"Full Name"`, `"Role"`, `"Headshot"`) -> card grid layout with `repeat(auto-fit, minmax(280px, 1fr))` -> avatar with brand-color fallback initials -> loading skeleton matching card shape -> empty state with "No team members yet" **User:** "I need a form that pulls events from the Luma API and sends a webhook" **Claude:** Reads `datasources/rest-api.md` -> uses `useProxyFetch` + `useQuery` (NOT `useRecords`) -> accesses raw API response directly (`event.name`, not `record.fields.name`) -> Select dropdown with event name + formatted date -> webhook via regular `fetch()` (not proxied) -> loading/error/empty states ## Data Sources Softr supports 14 data sources. **Before writing any data-fetching code, read the relevant guide:** | Data Source | Guide | Approach | |---|---|---| | Softr Databases | [datasources/softr-database.md](datasources/softr-database.md) | `useRecords` + `q.select()` | | Airtable | [datasources/airtable.md](datasources/airtable.md) | `useRecords` + `q.select()` | | Google Sheets | [datasources/google-sheets.md](datasources/google-sheets.md) | `useRecords` + `q.select()` | | HubSpot | [datasources/hubspot.md](datasources/hubspot.md) | `useRecords` + `q.select()` | | Notion | [datasources/notion.md](datasources/notion.md) | `useRecords` + `q.select()` | | Coda | [datasources/coda.md](datasources/coda.md) | `useRecords` + `q.select()` | | monday.com | [datasources/monday.md](datasources/monday.md) | `useRecords` + `q.select()` | | SmartSuite | [datasources/smartsuite.md](datasources/smartsuite.md) | `useRecords` + `q.select()` | | ClickUp | [datasources/clickup.md](datasources/clickup.md) | `useRecords` + `q.select()` | | Xano | [datasources/xano.md](datasources/xano.md) | `useRecords` + `q.select()` | | Supabase | [datasources/supabase.md](datasources/supabase.md) | `useRecords` + `q.select()` | | BigQuery | [datasources/bigquery.md](datasources/bigquery.md) | `useRecords` + `q.select()` | | SQL Database | [datasources/sql-database.md](datasources/sql-database.md) | `useRecords` + `q.select()` | | REST API | [datasources/rest-api.md](datasources/rest-api.md) | `useProxyFetch` + `useQuery` | **A block can connect to MORE THAN ONE of these at a time.** Declare them with `datasource.define({ alias: "uuid" })` and pass `from: ds.alias` on every data hook — read two tables and write to a third from a single block. Required reading before building anything multi-table: [datasources/multi-datasource.md](datasources/multi-datasource.md). (This replaces the old one-table-per-block limit and the invisible-helper-block workaround.) Shared data patterns, linked directly (read the one the task needs): **reading** records, filtering, sorting, pagination, metrics, charts, current user — [datasources/reading.md](datasources/reading.md); **writing** — mutations, sequential write queues, uploads, field-type write shapes — [datasources/writing.md](datasources/writing.md); **field values** — `getFieldValue()`, field shapes, debug blocks — [datasources/fields.md](datasources/fields.md). ([datasources/shared-patterns.md](datasources/shared-patterns.md) is the thin index of the same set.) For data source comparison and selection guidance, see [datasources/overview.md](datasources/overview.md). ## Reference Guides For advanced patterns beyond data fetching, load the relevant reference when the task needs it: | If the task involves... | Load reference | |---|---| | Reading/writing **several tables from one block** — `datasource.define()`, the `from:` parameter, obtaining the datasource UUIDs (and why Studio's chat invents them), what a connection's records endpoint releases, including one that only creates | [datasources/multi-datasource.md](datasources/multi-datasource.md) | | Cross-*block* communication, window globals, breadcrumbs, publishing shared computed state. *(Multi-table reads no longer need a helper — use a second datasource.)* | [references/helper-blocks.md](references/helper-blocks.md) | | Embedding third-party libraries with their own CSS (Leaflet, Mapbox, TinyMCE, Quill, FullCalendar) | [references/advanced-integrations.md](references/advanced-integrations.md) | | Debugging a broken block, checking patterns before delivery, full violation catalog | [references/anti-patterns.md](references/anti-patterns.md) | | Quick syntax check — import paths, hook signatures, mutation call shapes, field mapping, Softr navigation variables (`--nav-height` etc.), container-query syntax | [references/quick-reference.md](references/quick-reference.md) | | Any **dropdown / picker / combobox** in a block — why shadcn `` both fail inside the shadow DOM, the `composedPath()` click-outside, sorting A→Z inside the component, multi-token filtering, **searchable by default** regardless of option count (`bare` inline editors click-only; `searchable={false}` only for a short fixed enum being set), the `bare` inline-editor variant, focus moved into the Combo on open (Safari does not focus a clicked button) and Escape that closes only the list | [references/searchable-dropdown.md](references/searchable-dropdown.md) | | Any **date field** in a block — why `` can't carry a brand (its calendar is browser UI), the `DatePicker` kit (API, the full component), the kit-between-markers convention with a sync script for shared components, lessons from a 12-block rollout (clipping, short modal bodies, named containers and `textClass`, Escape, backdrop clicks, a modal's focus fix-up, Safari focus, `"yyyy-MM-dd"` values), short-screen placement (compact and capped calendar, phone spacer, instant scrolls), how to verify a block and verifying a change to the kit, the comments beside the kit and the block's size after a kit change | [references/date-picker.md](references/date-picker.md) | | **Printing** anything from a block — always a new window/tab holding its own document, never `window.print()` on the page or an in-page print view: the escaped HTML builder, pop-up-safe opening from the click, print-when-ready (stylesheets, fonts and images, capped), Print disabled until the data has loaded, the `?print=1` deep link from another page, paper layout (shared ``, `vertical-align: middle`, tick boxes) | [references/printing.md](references/printing.md) | | Small reusable patterns — `localStorage` cross-page state, clipboard copy button, measuring the block's own width (not the window's), clearing Softr's sticky top bar and phone tab bar, an in-block modal above Softr's bars (instead of shadcn `Dialog`), a **signature** drawn in a popup and uploaded as a PNG into an attachment field (the path kept as text, the upload's measured behaviour, reading a stored path back safely) | [references/common-patterns.md](references/common-patterns.md) | | Writing Airtable Automation Scripts / Scripting Extension scripts / Airtable formulas — companion to Softr blocks for cross-table cascades and computed values. If the `airtable-automation` skill is installed, use it instead: it holds the team's conventions | [references/airtable-automations.md](references/airtable-automations.md) | | The official **Softr MCP server** — Softr DB schema + full record/table/field/database CRUD (deletes included), putting files into attachment fields (a local file through an upload link, or a URL), choosing a table's primary field, creating saved views (hidden fields, sorting, grouping, filter), an app's data restrictions (read and set; enforced on a block's records endpoint), field-level browsing of connected integrations (Airtable / Google Sheets / Notion / Supabase and more) and a sample of their real records, **creating, editing, versioning, and deploying Vibe Coding blocks directly** (`vibe_coding_block_get_docs`, `vibe_coding_block_create`, ...), push verification by `sourceSha256`, a connector signed in to the wrong Softr account (`application_get` and `workspace_list` first), a blocked push and keeping the finished work, a large push cut by size and op count, a new block created, pushed and mirrored by one job, the records endpoint of a create-only connection and its guard (a Source condition that matches nothing), app management/scaffolding, navigation menus (items with `application_navigation_set_items`, layout, display settings, which menu a page shows; a page's VIEW permission and title stay Studio-only), the **Softr Workflows** suite (36 tools, 418-node catalog; FILTER conditions are written over MCP with `workflow_update_filter_node_condition` since 2026-11-13, never with `workflow_update_node_inputs`), and **per-application MCP servers**. Tool names changed on 2026-10-01; the file carries the old → new map | [references/softr-mcp.md](references/softr-mcp.md) | | **Checking a pushed block in a browser** — rendering and behaviour in a Softr preview with the agent-browser CLI (ask before installing it): running it in the client's time zone (`TZ` when the session starts) and comparing shown date-only values with the stored ones, the preview cookie, reaching into the block's shadow DOM through accessibility refs, measuring with `eval`, blocking and proving the save endpoint before any click, reading what a click sent, screenshots to disk, testing Custom Code header CSS | [references/browser-checks.md](references/browser-checks.md) | | **QA of a whole app** — the order to run a pass after the blocks are pushed: set-up (the draft, the served build, the client's zone, one session per agent), never writing by accident, roles, logged-out access, figures checked against the database, edges tested on purpose, proving a fix before and after in a local harness, a live write pass with a read-only checker, proving a read guard on a create-only connection, rendering a block's own code in jsdom, a cross-block contract check, gating a pipeline's stages on the evidence of the one before, running QA with several agents and skeptics, saying what did not run | [references/qa-playbook.md](references/qa-playbook.md) | | Restyling Softr's **native shell — header / footer / nav / dropdowns / page background** (not a block; it's Softr chrome, done with global Custom Code CSS): stable selectors vs. hashed classes, floating "island" header+footer, the dropdown blank-space grid fix, the multi-layer page-background stacking, restyle-vs-replace, and the **app frame** for sidebar apps (top bar + sidebar as one frame in the theme colour, the content as one paper sheet with a pinned rounded corner, blocks transparent, scoped with `:has()` so Log in / 404 keep Softr's colours) | [references/native-chrome-styling.md](references/native-chrome-styling.md) | | **Opening a block from Softr's navigation** (or from any Softr link or action) as an overlay: the block gets a page of its own that opens in a Softr **Modal**. What Softr renders (a dialog around a same-origin iframe), what changes for block code in it (its own `window`, `window.parent` as the opener, no toasts, Escape, Softr's `beforeunload` close guard), closing from inside, a page-mode recipe, the nav button added in Studio or over MCP, pitfalls (a link interceptor catching the nav button, the page's inherited permission) | [references/modal-pages.md](references/modal-pages.md) | | Adding a **dynamic date filter or custom filter control to a native List/Grid block** (via a Custom Code Static block, not a Vibe block): drive the block's conditional filter with `{URL_PARAM:…}`, the empty-param "match nothing" wide-range sentinel, inject the control into the filter row and keep it alive across Softr's re-renders | [references/native-block-filters.md](references/native-block-filters.md) | | **Editable settings deep-dive** — full hook catalog (incl. verified-undocumented `useLongTextSetting` and the `navigation` array-schema type), settings-first granularity doctrine, heading-line-split and `-text`/`-link` pairing patterns, naming conventions, rename-resets-value gotcha, empty-media gating, key-by-index rule | [references/editable-settings.md](references/editable-settings.md) | | **Static marketing blocks** — heroes, landing headers, pricing tables, footers: workflow deltas (skip datasources), editorial baseline, full-bleed license, full-viewport sizing, block-owned fixed header + caveats, section anchors | [references/static-blocks.md](references/static-blocks.md) | | Generating or refreshing a project **`DESIGN.md` with dembrandt** — MCP + CLI install (`@latest` npx, one-time browser step), the extract → poll → `get_findings` → `generate_design_md` → write-`./DESIGN.md` flow, multi-page crawls, DESIGN.md anatomy (frontmatter tokens, Font URLs), authoring `custom-code-header.html` from tokens, brand-drift QA with `compute_drift` | [references/dembrandt.md](references/dembrandt.md) | ## Code Structure Every block follows this shape: ```jsx // imports at the top import { ... } from "@/lib/datasource"; // ...other imports export default function Block() { // hooks, state, logic return (
{/* block content — wrapper padding depends on placement; see "Block Placement & Page Spacing" */}
); } ``` Wrap the outermost layout in `container` and `content` divs by default — these constrain width to match the Softr app's max width settings so the block aligns with neighboring native blocks. Note this is a **house convention, not platform-enforced**: per the official developer guide the platform default is full width, and the classes are merely "available" to constrain it (verified 2026-08-31 against `vibe_coding_block_get_docs` and a rendering wrapper-free Studio-AI hero). The wrappers also bring **window-based gutters**. Inside a Vibe host, `.container`'s side padding is `--container-x`, which `:host([data-container-padding-x=…])` sets on WINDOW media queries: `regular` is 16px, then 24px from a 576px window (the 768px step keeps 24px), more from 992px (`0 32px` measured on a 744px block at a 1024px window); `tab` 0px, `container` 8px, `none` 0px (read from the block's compiled CSS and measured, 2026-10-05). On a full-width page that is harmless; beside Softr's sidebar the gutter steps on a width the block doesn't have — one reason app pages there drop the wrappers. **Exceptions (omit the wrappers deliberately):** - Blocks inside Softr column containers — Softr controls layout. - Full-bleed marketing blocks (heroes, banner bands, footers) — backgrounds and decorative shapes run edge-to-edge; the block then owns its own gutters (`px-6 md:px-12 lg:px-16`, window breakpoints: right on a full-width page, wrong beside a sidebar) and inner max-widths, and records the choice in the `// BLOCK PLACEMENT:` comment. See [references/static-blocks.md](references/static-blocks.md#full-bleed-layout-license). - App pages beside Softr's sidebar / top-bar navigation, inside a frame the header code paints — the block is full-bleed AND transparent (no background, no page panel), owns container-query gutters (`px-4` → `@min-[40rem]:px-6` → `@min-[64rem]:px-10`) and lays out by its own width. See [App pages beside Softr navigation](#app-pages-beside-softr-navigation). ## Block Placement & Page Spacing Blocks rarely live alone — most Softr pages stack 2–4 blocks vertically, often between a header and a footer. Spacing must be set per-block based on **where the block sits on the page**, so adjacent blocks don't double up padding or leave inconsistent gaps. **General rule:** the inner wrapper (the `
` directly inside `
`) owns all vertical spacing. The outer `container` is always `py-0`. Top and bottom padding on the wrapper change based on what's above and below the block (another block, a header, a footer, or nothing). **When generating a new block, if the placement is not clear from the user's description, ASK before writing code:** - Where will this block sit on the page? (top / middle / bottom / standalone) - Is there a Softr header immediately above this block? - Is there a Softr footer immediately below this block? - Is there a Back button at the top of this block? - Does the page show Softr's sidebar / top-bar navigation, with header code painting an app frame? If so, the block follows [App pages beside Softr navigation](#app-pages-beside-softr-navigation) instead of the wrapper table below. **Detail pages — always ask about the back button AND its fallback URL.** A "detail page" is any block that reads a single record by URL recordId (i.e. it calls `useCurrentRecordId()` / `useRecord()`, or the user describes it as the target of a `/page?recordId=...` link). Users almost always want a back button there but rarely think to mention it, and shipping the page without one is the most common UX gap on these screens. So even if every other placement detail is clear, ask both: 1. **"Should the detail page have a back button?"** — if yes, always wire one. Use the back-navigation pattern in [references/helper-blocks.md](references/helper-blocks.md#breadcrumb--back-navigation): `window.history.back()` for users with history, plus a fallback URL for users who arrived via shared link. 2. **"What page should the back button fall back to when there's no history?"** — this is a separate question, easy to skip but important. Don't default silently; ask. If the user doesn't have a listing page yet, default to `/` and leave a `// TODO: update fallback when /jobs (or similar) exists` comment so it can be updated later. **Chrome that repeats across pages must land in the SAME place on every page [house].** A back button, a page title, a primary action -- anything the user meets on more than one screen -- is a cross-page contract, not a per-block decision. Before adding one, open the blocks that already have it and copy the exact offset; when you change it, change it everywhere in the same edit. Verified the hard way 2026-09-09: an item-detail back button carried an extra `mt-6` that the project-header back button did not, so it sat 24px lower, and the mismatch only surfaced when a user moved between the two pages in one session. **No amount of reading a single block reveals this** -- each block looks correct alone, which is exactly why it needs to be a standing rule rather than a review item. Two habits make it survive: - **Let the wrapper's padding be the ONLY thing positioning repeated chrome.** Give the back button `mb-4` (space below it) and no top margin, so its offset is the wrapper's top padding and nothing else. One number per page then governs the position, and pages can only drift if their wrappers do. - **Loading skeletons repeat the chrome too.** A skeleton standing in for a page that has a back button needs that button's placeholder at the same offset as the real one, or the button visibly jumps the moment the record arrives. Change both in the same edit -- see §12 of [ui-ux-guidelines.md](ui-ux-guidelines.md). **Persist the answer as a grep-able comment at the top of the generated file** so future edits know the spacing assumptions and can be updated consistently: ```jsx // BLOCK PLACEMENT: ,
, // Spacing: ``` Example: ```jsx // BLOCK PLACEMENT: first block on page, header-adjacent, has Back button // Spacing: wrapper py-3 px-8; back-button container mt-6 mb-4 ``` The `// BLOCK PLACEMENT:` marker is intentionally stable so it can be grepped and updated when the block's surroundings change. ### Spacing values (defaults) **Container** (default — omitted by full-bleed blocks, app pages beside Softr navigation and blocks inside column containers; see table below): `
` **Inner wrapper** classes by block position: | Position on page | Wrapper classes | Rationale | |---|---|---| | First block (header-adjacent) | `py-3 px-8` | 12px top + 12px bottom; lets the Softr header own its own spacing | | Middle block | `py-3 px-8` | 12px + Softr separator + 12px ≈ 24px between blocks | | Last block (footer-adjacent) | `pt-3 pb-12 px-8` | 12px top + 48px bottom for footer breathing room | | Standalone (only block on page) | `pt-3 pb-12 px-8` | Treat like a last block | | Full-bleed (hero / banner / footer) | none — no container/content; block owns gutters `px-6 md:px-12 lg:px-16` | Edge-to-edge backgrounds on a full-width page; see [references/static-blocks.md](references/static-blocks.md#full-bleed-layout-license) | | App page beside Softr navigation (header code paints the frame) | none — no container/content, no background; `@container` root, then `px-4 pt-5 pb-12 @min-[40rem]:px-6 @min-[40rem]:pt-6 @min-[64rem]:px-10 @min-[64rem]:pt-8` | The only block on the page, on the header's paper sheet; gutters follow the block's width, not the window's; see [App pages beside Softr navigation](#app-pages-beside-softr-navigation) | **Back button** (when present at the top of a block — typically on detail pages): wrap in `
`. The `mt-6` (24px) adds breathing room above the button independent of wrapper padding; `mb-4` (16px) sits between the button and the first card. Apply this regardless of whether the block is first or mid-page. **Within-block stacked cards**: each card uses `mb-6` (24px). **Do NOT add `mb-6` to the last card** in a block — the wrapper's bottom padding already handles that buffer. Doubling them produces 32–40px gaps that look bigger than the within-block rhythm. **Net page rhythm**: between-block gaps (12 + 12 = 24px) match within-block card gaps (`mb-6` = 24px), so the page reads as one consistent vertical rhythm. ### App pages beside Softr navigation When the app uses Softr's **sidebar / top-bar navigation** and the app's header code paints the frame (the top bar and sidebar colour around the page, the content as one paper sheet with a rounded corner tucked under them; recipe in [native-chrome-styling.md → App frame (navigation layout)](references/native-chrome-styling.md#app-frame-navigation-layout)), the blocks on its app pages take a different shape. Verified live 2026-10-05 on a three-page HubSpot-backed app (a dashboard, an accounts list + detail, a request form): the header code on the published app and in the preview, the blocks measured in the preview. **Full-bleed, and the block paints nothing behind itself [house].** - No `container` / `content` wrappers, no background colour on the block's root, no gradient or rounded panel around the page (Premium Visual Baseline §1 does not apply). A panel on top of the sheet brings back the "card floating on a white page" look the frame exists to remove; Leo rejected exactly that. The block's own cards, borders and dividers stay the block's job, because header CSS cannot reach inside the shadow root. - The transparency comes from the header code, not the block. A Vibe host paints the Studio theme background (white by default) through its compiled `:host` rule even when the block sets none; the frame recipe clears it with a main-document rule on the host, `[data-role="vibe-block-root"]` (the `:host` rule isn't `!important`, so it loses). Without that header code, a block that paints nothing still sits on white (verified 2026-10-05). - **One block per page, and it owns the page's `h1`**; its panel titles are `h2`. No separate welcome or title block above it. The pattern was built and verified only with one block per page. If a page must hold more, only the first block takes the top padding and only the last takes `pb-12`; the rest use `pt-0` / `pb-0` with the same side gutters (untested). - **The same shell on every app page**, so the header lands in the same place (the cross-page chrome rule above): ```tsx // FONT and C.ink: the brand's UI font and ink colour (DESIGN.md tokens)
{/* the h1 header row, then the page */}
``` Measured padding (top, sides, bottom): `32px 40px 48px` on a 1160px block (a 1440px window minus a 280px sidebar), `20px 16px 48px` on a 390px block. - Why the wrappers go: `.container`'s gutters step on the window (see the note under [Code Structure](#code-structure)). **Lay out by the block's width, never the window's.** Softr's sidebar takes 57–360px of the window (280px by default, 57px collapsed, 200–360px when dragged), so `sm:` / `md:` / `lg:` fire on a width the block doesn't have: at a 1024px window the block is 744px wide, and at 768px with the sidebar open it is 488px. Measured 2026-10-05: an `lg:` five-column chart row fired on a 744px block and cut off its bar labels. Below a 768px window Softr swaps the top bar and sidebar for a bottom tab bar (767 = tab bar, 768 = top bar + sidebar). - Use Tailwind container queries: `@container` on a wrapper, `@min-[NNrem]:` on what's inside it. Softr's Tailwind compiles them (verified live 2026-10-05). Syntax in [quick-reference.md → Container queries](references/quick-reference.md#container-queries). - A container query never resolves against the element that carries `@container`, only against the nearest ancestor container. So `@container` goes on a wrapper, and the `@min-…` classes go on its descendants. - Nest another `@container` on a pane (a detail panel, a side column) so its inner rows and strips follow the pane, not the page. - Thresholds are BLOCK widths. From that app (the numbers are the project's; the method is the reusable part): | Part | Narrow | Wide | From (block width) | |---|---|---|---| | Figure strip | 2 columns | 4 columns | `@min-[52rem]:` | | Chart row | stacked | 5-column grid, spans 2 + 3 | `@min-[64rem]:` | | Form + side list | stacked | `grid-cols-[minmax(0,44rem)_minmax(18rem,22rem)]` | `@min-[56rem]:` | | List + detail | list, then detail | side by side | 860px, decided in JS: a 340px list + 20px gap + at least 440px of detail + the shell's padding | Work each threshold out from the parts it has to fit (the list + detail row shows how), then check it at real block widths with the real fonts. A padding change moves where text wraps: after the switch to this shell, a figure-strip skeleton keyed to the old wrap point no longer matched the loaded cells (measured 2026-10-05 across block widths with the real fonts). - When CSS can't decide (which component tree to render, how many chart ticks fit), measure the block: [common-patterns.md → Measure the block, not the window](references/common-patterns.md#measure-the-block-not-the-window). Measure in `useLayoutEffect`; a passive `useEffect` paints the first frame at the window's width, and beside a sidebar the layout visibly flips. **Clear Softr's sticky bars with the host's variables.** Softr's top bar is sticky (56px, z-index 800), and on phones so is the tab bar (about 57px as rendered, though Softr's variable says 55px; z-index 800). The Vibe host maps the bar and sidebar sizes onto `--nav-height`, `--sidebar-width` and `--bottombar-height`, each falling back to `0px` (values in [quick-reference.md → Softr navigation variables](references/quick-reference.md#softr-navigation-variables)). Use them only inside CSS `calc()`, e.g. a sticky list pane: ```tsx
``` A plain `sticky top-4` slid under the top bar; with the variable the pane sits at 72px (measured 2026-10-05). JS that scrolls the window or sizes a popover has to clear the bars too: [common-patterns.md → Clear Softr's sticky bars](references/common-patterns.md#clear-softrs-sticky-bars). **Check it where the header code runs.** Header code applies on the published app and in Softr's preview (verified 2026-10-05, seen after a publish; whether the preview shows a pasted but unpublished change is untested, so inject it instead), not in the Studio editor canvas, so judge the page in the preview: [browser-checks.md → Testing Custom Code header CSS](references/browser-checks.md#testing-custom-code-header-css). **Record it in the placement comment:** ```tsx // BLOCK PLACEMENT: the only block on ; it owns the page's h1. FULL-BLEED by design: no container/content // wrappers and no background of its own; the app's header code paints the frame and the paper sheet. // Spacing: px-4 pt-5 pb-12, then px-6 pt-6 from a 40rem block and px-10 pt-8 from 64rem (same shell on every page). // LAYOUT follows the block's own width (@container queries), never the window. ``` ### Full-viewport hero blocks A hero may size itself to the viewport — vh units inside a block resolve against the real window (blocks are shadow DOM in the main document, not iframes — except a page Softr opens in a Modal, which loads in a same-origin iframe, so there `vh` and `position: fixed` resolve against the modal box (read from Softr's bundles 2026-10-09, not yet run live): [references/modal-pages.md](references/modal-pages.md)). The Studio-verified responsive shape is `min-h-screen lg:min-h-0 lg:h-screen` (natural height on mobile, locked viewport height on desktop). Three rules: (1) `h-screen` fills the window only when the native header is hidden on that page — with a native header above, a 100vh block overflows by the header height; use `min-h-[calc(100vh-)]` when native chrome stays; (2) hard `h-screen` + `overflow-hidden` + centered flex **clips settings-grown content unrecoverably** — prefer `lg:min-h-screen` unless the locked look is explicitly wanted; (3) the standard spacing table above does not apply — the hero owns all its spacing. Extend the placement comment: `// BLOCK PLACEMENT: full-viewport hero, native header hidden, owns all spacing`. Full detail in [references/static-blocks.md](references/static-blocks.md#full-viewport-hero-sizing). ## Premium Visual Baseline **Every block must look polished in its first version.** Styling is not a follow-up task — it is a core requirement of every code generation. Apply ALL of the following by default unless the user explicitly requests a minimal/plain style (one carve-out: §1's gradient wrapper is dropped on app pages inside a header-painted frame). **Scope: this is the app-UI baseline** — dashboards, lists, forms, detail pages. Static marketing blocks (heroes, landing sections, footers) use the **editorial baseline** in [references/static-blocks.md](references/static-blocks.md#editorial-baseline-replaces-the-premium-visual-baseline) instead — typographic hierarchy and brand-exact values, no gradient wrapper/cards/skeletons/empty states (nothing loads). Refer to [ui-ux-guidelines.md](ui-ux-guidelines.md) for full design principles. ### 1. Gradient background wrapper ```jsx
{/* header + content cards go inside here */}
``` Adjust the top gradient color to complement the user's brand. **Exception — app pages inside a header-painted frame.** When the app's header code paints the frame and the paper sheet beside Softr's sidebar navigation, drop this wrapper and any rounded page panel: the block paints no background at all. A panel on the sheet recreates the "card floating on a white page" look the frame exists to remove (rejected by Leo, 2026-10-05). The cards inside the block (§3) stay. See [App pages beside Softr navigation](#app-pages-beside-softr-navigation). ### 2. Header section - Icon in a colored rounded square (`h-10 w-10 rounded-xl` with brand primary, white icon) - Title at `text-2xl font-bold` - Optional subtitle in `text-muted-foreground` - Primary CTA button with `shadow-md hover:shadow-lg transition-shadow` ### 3. Card-based content - `bg-white rounded-xl shadow-sm border border-gray-100` - Items with `hover:shadow-md hover:border-gray-200 transition-all duration-200` - Use `space-y-3` or `gap-3`, never flat separators ### 4. Avatar and identity elements - Brand primary color as avatar fallback with white initials - `h-12 w-12` for list items, `h-28 w-28` for profiles - `border-2 border-white shadow-lg` on profile avatars ### 5. Interactive feedback - Buttons: `shadow-md hover:shadow-lg transition-shadow` - Cards: `hover:shadow-md hover:border-gray-200 transition-all duration-200` - Active states: blue left border accent (`border-l-4`) ### 6. Status and metadata - Counts in pill badges: `text-xs font-medium px-2 py-0.5 rounded-full` - Dates with icons (Calendar, Mail, Users) ### 7. Empty states - Large icon in gradient square (`h-20 w-20 rounded-2xl`) - Clear heading + explanation + CTA button ### 8. Loading states - Skeleton shapes matching the final layout, `rounded-xl` ### 9. Error states - Icon in tinted background, clear message, retry button ### 10. Modals and dialogs - Icon in dialog title, required field markers, example placeholders ## Styling & Components **Tailwind CSS** is pre-configured. **Semantic color tokens** preferred: `bg-background`, `bg-card`, `bg-primary`, `bg-secondary`, `bg-muted`, `bg-accent`, `bg-destructive`, `border`, `border-input` **Arbitrary values compile in full** — the platform's Tailwind build is JIT, so the whole arbitrary-value syntax works, including opacity modifiers on arbitrary hex (`bg-[#FAF5EC]/85`), variant + arbitrary + opacity combined (`hover:bg-[#6E7A5C]/10`), negative arbitrary values (`-top-[22%]`, `hover:-translate-y-[1px]`), arbitrary object-position (`object-[62%_25%]`), arbitrary z (`z-[1]`), and vw sizing (verified 2026-08-31 from rendering Studio-AI output). Classes must be **static source strings** — never template-interpolate (`` bg-[${x}] ``); JIT extracts classes by static scan (standard-Tailwind inference, not Softr-verified). When to reach for them vs. the scale: see the editorial lane in [ui-ux-guidelines.md](ui-ux-guidelines.md) §7. (This covers arbitrary *values* and standard variants; arbitrary *selector* variants like `[&_svg]:` have at least one known bundler failure — see the SelectTrigger row in [references/anti-patterns.md](references/anti-patterns.md#layout--styling).) **A brand colour you use BOTH ways exists twice, and the two copies drift silently.** Arbitrary values are resolved at build time, so a class string can never read your `C.accent` constant. A card styled with Tailwind (`border-[#3B1F2B] hover:border-[#54594F]`) and its loading skeleton styled inline (`style={{ border: "1px solid " + C.accent }}`) therefore hold the same colour in two places that no compiler will ever reconcile, and nothing fails when they disagree -- it just looks wrong. Verified 2026-09-09: a card's rest border was changed and its skeleton's was not, so the whole grid visibly re-outlined itself the instant the data arrived. Two habits keep it honest: write the hex-to-token mapping in a comment beside the class string (`#3B1F2B = C.accent`), and prefer the runtime token wherever inline `style` is already in play, so only one of the two copies is ever a literal. **Font classes:** `font-heading`, `font-sans`, `font-mono` **Conditional classNames:** `import { cn } from "@/lib/utils";` — template-literal conditionals (`` className={`base ${cond ? "a" : "b"}`} ``) are equally valid (Studio AI emits them); prefer `cn()` when merging many groups or de-duplicating conflicting classes. **DO NOT USE:** CSS modules, styled-components, or CSS file imports. **shadcn/ui components** at `@/components/ui/[name]`: accordion, alert, alert-dialog, aspect-ratio, avatar, badge, button, calendar, card, carousel, chart, checkbox, collapsible, command, context-menu, dialog, drawer, dropdown-menu, empty, hover-card, input, input-group, input-otp, item, kbd, label, menubar, native-select, navigation-menu, pagination, popover, progress, radio-group, resizable, scroll-area, select, separator, sheet, skeleton, slider, sonner, spinner, switch, table, tabs, textarea, toggle, toggle-group, tooltip **Common import patterns:** ```jsx import { Button } from "@/components/ui/button"; import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; ``` **Lucide Icons:** `import { TrendingUp, User, Settings } from "lucide-react";` **Dynamic icons by name string:** `` from `@/components/dynamic-icon` renders a Lucide icon when you only know its name at runtime (e.g. from an editable setting, a window global, or a `useRecords` row). Pass the kebab-case Lucide name as `name`. Use this — not a manual lookup table — whenever the icon is data-driven. ```jsx import { DynamicIcon } from "@/components/dynamic-icon"; ``` **Softr's ``** is a built-in component for triggering Softr-native navigation actions from inside a Vibe Coding block. Accepts a `recordId` prop for dynamic record-specific URLs and supports action types `OPEN_URL`, `OPEN_PAGE`, `OPEN_CHAT`, `TRIGGER_CUSTOM_WORKFLOW`. Prefer this over bare `` when you want Softr's user-group visibility checks and slide-out / modal navigation styles to apply. Bare `` is still fine for simple in-app links where you don't need that behavior. The canonical pattern pairs a shadcn ` ``` **Action types — what each one needs in `initialValue`:** - `OPEN_CHAT` — opens Softr's AI chat. **No `destination` or `openIn` needed** — it's the cheapest "Ask AI" button to wire up. **GOTCHA:** Softr's AI pulls context from the block that triggered the chat, NOT from the page. If the block has no data source connected, `chat/prepare` returns HTTP 500 ("Failed to prepare AI assistant") even though the chat panel opens. Fix: in Softr Studio, connect the block to whatever data source the AI should read from — even if the block doesn't read or write any records itself, the connection is what gives the AI context. Verified by direct experiment, May 2026: a button-only helper block with no data source caused this exact failure; connecting it to the same table as the main block fixed it without any code change. - `OPEN_URL` — opens a URL. Needs `destination` (the URL) + `openIn` (`"SELF"` | `"TAB"` | `"MODAL"`, the same three as `OPEN_PAGE`). - `OPEN_PAGE` — navigates to a Softr page in-app. Needs `destination` (page path) + `openIn` (`"SELF"` | `"TAB"` | `"MODAL"`). The developer guide (a copy read 2026-10-06) types `openIn` as `"SELF" | "TAB" | "MODAL"` for both `OPEN_PAGE` and `OPEN_URL`, and Softr's own navigation block 5.0.7 (read 2026-10-09) offers the same three on its nav items; what Studio's own picker offers for a block's `OPEN_URL` was not checked. `MODAL` also carries the builder's `modalSize` (`"SM"` | `"MD"` | `"LG"` | `"XL"`) and `modalType` (`"POPUP"` | `"SLIDING"`). A page opened in a Softr Modal from the navigation loads in a same-origin iframe (read from Softr's bundles 2026-10-09); that a block's `MODAL` uses the same dialog is unverified: [references/modal-pages.md](references/modal-pages.md). - `TRIGGER_CUSTOM_WORKFLOW` — runs a Softr workflow. - **Setting shape:** the documented shape is `{ action: "TRIGGER_CUSTOM_WORKFLOW" }` with no `destination`, the same shape as `OPEN_CHAT`. The type also carries an optional `actionId`. The builder picks which workflow it points at. Whether a `destination` is also accepted is not verified live, so don't rely on one. - **Calling it from code:** besides ``, the live developer guide documents `navigate(setting, { recordId, datasourceId })` ("Runs the workflow with recordId and datasourceId"). It is callable from a mutation's `onSuccess`, e.g. to run a workflow on a record `useRecordCreate` just made (documented 2026-10-05; not yet run end to end by us). - **The receiving end** is the Softr Apps trigger **"Run custom workflow"** (`SOFTR_APPS_TRIGGER_WORKFLOW`) in the workflow node catalog. The vibe path documents only `recordId` and `datasourceId` as payload, and the trigger is browser-callable, so have the workflow re-read the record rather than trust its input. - Workflows themselves are buildable via MCP; see [references/softr-mcp.md](references/softr-mcp.md#workflows). When the action navigates to a record-specific page, pass the runtime record id via the `recordId` prop on `` (not on the setting) so Softr can resolve dynamic URLs: ```jsx View wig ``` For on-brand custom styling (matching the Step 1 brand tokens' inline-style conventions instead of shadcn Button), wrap the same pattern with a styled `