Slice · AI prompt
Write HTML/CSS/JS, see it render live in a sandboxed iframe (opaque origin), Save to a shareable link — backend injected.
# Install `html-studio` — HTML Studio — sandboxed HTML/CSS/JS editor with live preview
> Write HTML/CSS/JS, see it render live in a sandboxed iframe (opaque origin), Save to a shareable link — backend injected.
📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail : https://resource.rahmanef.com/slices/html-studio
🧠 JSON catalog : https://resource.rahmanef.com/api/knowledge?slice=html-studio
🔗 Source : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/html-studio
## 1. Install
```bash
npx rahman-resources add html-studio
# alias: npx rr add html-studio
```
The CLI copies `frontend/slices/html-studio/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.
## 2. What it ships
- npm: `lucide-react`
- shadcn primitives: `button`, `input`, `textarea`, `scroll-area`
## 3. Wire it up
Stack: Next 16 + React 19 + Tailwind 4 + shadcn/ui. A sandboxed HTML/CSS/JS studio: editor + live iframe preview + saved pages. Fully client-side; backend optional.
STEP 1 — Install. `npx rr add html-studio`. Ensure `@/features/html-studio` resolves and Tailwind scans the slice folder.
STEP 2 — Deps. npm: `lucide-react`. shadcn: `npx shadcn@latest add button input textarea scroll-area`.
STEP 3 — Mount. `<HtmlStudio />` in a height-bearing box — unwired it runs on an in-memory mock (editor + live sandboxed preview + saved list all live). Pass `payload={{ slug }}` to open a page, or register `htmlStudioApp` in an appshell manifest.
STEP 4 — Real backend. `configureHtmlStudio({ mode:"live", save, load, list, remove })` — save takes { slug?, title, html, visibility } and returns { slug }; load(slug) -> SavedPage | null; omit save for a read-only sandbox or list to hide the saved rail. KEEP the iframe sandbox without allow-same-origin — it is the security boundary.
## Rules of engagement
- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice
The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.