1. Live Canvas Previews
Instead of presenting static code blocks, Accelerated Logic AI can render live, working web components inside isolated sandboxed iframes within the chat thread.
Test component state changes, button hover effects, and responsive layout scaling directly inside your message stream.
Toggle effortlessly between live visual execution (Preview Mode) and raw syntax-highlighted code (View Code).
2. How Canvas Previews Are Triggered
The AI automatically detects UI intent, but you can explicitly trigger or suppress previews using prompt keywords:
Force Preview Triggers: "Preview in canvas", "Show live preview", "Render as interactive preview", "Display as working UI".
Suppress Preview Triggers: "Only output code block, no preview", "Do not render preview, just show code".
3. The Interactive Preview Card Structure
Top Header Bar: Displays the AI-generated title (e.g. Kanban Board - Drag & Drop) and language badge (tsx / html).
Sandboxed Canvas Area: Isolated iframe environment pre-loaded with Tailwind CSS, Lucide icons, and React 18 runtimes.
Footer Controls: Click View Code to inspect raw source files, or click Open in Web Sandbox to transfer the component into the multi-file editing suite.
4. Ideal Code Patterns for Canvas Previews
Single-file components exported as export default function App() deliver instant, error-free visual previews.
Pre-wired for lucide-react icons, standard React state hooks (useState, useEffect), and utility classes.
5. Handoff to Web Sandbox Workspace
When a single-file preview requires multi-file modularization, backend API routing, or GitHub pushing:
- Click Open in Web Sandbox on the bottom bar of any preview card.
- The full Web Sandbox workspace opens instantly with file trees, responsive device viewports, and console debugging.
- Prompt the chat assistant to make surgical multi-file edits or export directly to GitHub.
6. Canvas Preview Troubleshooting
Blank White Preview Frame? Switch to View Code or open in Web Sandbox to inspect runtime syntax errors in the console.
Unstyled Elements? Confirm that the component utilizes standard Tailwind utility classes, which are automatically resolved by the preview runtime.
External Module Import Errors? For complex external packages, open the preview in Web Sandbox to resolve npm dependencies.
7. What Makes a Preview Worth Having
A live preview earns its keep only for UI you can poke. Ask the model for one when interactivity is the point — and skip it when it is decoration:
- Stateful widgets: tabs, accordions, toggles, dropdowns, modals
- Forms with validation feedback as you type
- Charts whose datasets you change by clicking
- Drag/drop, hover, and focus-visible behavior you need to feel
- Pricing tables, comparison toggles, step wizards
- API handlers, server logic, auth flows — nothing executes
- Static prose pages, articles, READMEs
- Design tokens / pure type definitions
- Anything requiring network calls to private endpoints
Rule of thumb: if you would want to click three buttons to be happy, ask for a preview; otherwise ask for the code and read it.
8. Writing Canvas-Ready Components — the Contract
- One file, default export.
export default function App()— named default, no required props, no external imports outside the whitelisted runtime (React hooks, lucide-react). - No external data dependencies. Inline the sample data as constants; fetch-what-you-need live inside the component (a public CORS API), never from env vars — the preview has no secrets to read.
- Tailwind only, no config tricks. Standard utility classes compile in the preview; custom
tailwind.configextensions and@applylayers do not exist there. - Hooks are fine; effects are your responsibility.
useState/useEffectrun — an effect that fetches on mount will actually fire, twice in StrictMode-style dev flows, so guard idempotency. - Size budget. Keep components under a few hundred lines — canvas frames are for demonstrating interaction, not for landing the entire app. Escalate to Web Sandbox when the file crosses that line.
9. The Handoff: Preview → Web Sandbox Checklist
- Click Open in Web Sandbox on the preview card footer — the component moves into the virtual project tree, single-file intact.
- Modularize: ask the assistant to split shared pieces ("extract DataTable into src/components/DataTable.tsx") — multi-file is where the sandbox outshines canvas.
- Wire real entry content: sample data → your actual fixture shapes; confirm props contracts still hold after the move.
- Run through the three viewports (desktop/tablet/mobile) and the console drawer from zero — sandbox errors only accuse real bugs, not preview limits.
- Export: ZIP for your own repo, or Push to GitHub when it graduates (Part 17).
If the goal is just "show my team the concept", skip the handoff — preview cards are linkable within the thread and screenshot fine. The sandbox is for continuing to build, not for proving you built it.
10. Preview Limits You Will Eventually Hit
- No serverless, no API routes.
/api/*paths 404 inside the iframe — previews are purely client-side. - Whitelisted libraries only. Fancy charting libs, animation kits, and state managers beyond the built-ins will not import; workarounds: plain React + Tailwind reimplementation, or hand off to Web Sandbox where the dependency story is the project's own.
- Storage is isolated per frame and not shared with the workspace — data entered in a preview does not leak into your app state (a feature, not a bug), and does not survive frame teardown.
- Strict CSP inside the frame means external scripts beyond the runtime are blocked; hot-loading a CDN library you "just need this once" will fail silently — check the console drawer if a preview behaves deaf.
- Size ceilings. Very large components stream slowly into the frame; above a few thousand lines expect a laggy first paint — another nudge toward Web Sandbox.