building-react-quill-canvases
Fungsinya
Skill ini membangun canvas interaktif, seperti dasbor, papan data, dan alat, menggunakan React dan sistem desain milik PostHog. Ditujukan untuk siapa saja yang menginginkan canvas seperti aplikasi yang sesuai dengan tampilan PostHog.
Kapan dipakai
- βSaat Anda ingin dasbor atau papan data interaktif di dalam PostHog.
- βSaat Anda memerlukan formulir, alat, atau canvas bergaya aplikasi dengan tombol dan input.
- βSaat canvas harus sesuai dengan tampilan PostHog dalam tema terang maupun gelap.
Link skill
https://github.com/PostHog/posthog/blob/master/products/canvas/skills/building-react-quill-canvases/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBangun canvas interaktif dengan pemilih tanggal dan tiga kartu metrik untuk pengguna uji coba.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
AI menulis satu komponen React yang dipasang oleh PostHog, menggunakan komponen dan impor yang diizinkan, dan memuat setiap kartu data secara terpisah. AI menjaga tema dan status pemuatan tetap konsisten dengan desain PostHog.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Building React + Quill canvases
The whole application is one React/TSX file (src/canvas.tsx in the source project). It must
export default a single React component that takes no props β the host mounts it. Do not import
react-dom or call createRoot.
Start from the working scaffold in references/starter-scaffold.md
on a first build: it already wires the date picker, theme tokens, per-query loading state (every
card fills in independently as its own data lands), and correct typed-node result reading. Keep
that wiring; replace the sample metrics and layout.
Keep its pattern of one component per card with editable() params, and follow the "Params" section of the building-canvases skill for each card you add.
Imports
Use React, Quill, Recharts, Lucide, and Day.js for the standard application shell. The platform also admits ten optional libraries for specialized work. Read references/platform-libraries.md before choosing one.
PostHog data comes through import { ph } from "@posthog/canvas-sdk" β a platform-provided
module, so it needs no dependencies entry. The same object exists as the window.ph global
(how existing canvases reach it); prefer the import in new code.
Other bare imports, dynamic import(), require(), <script> tags, and remote code fail
validation. Direct network requests and external images, fonts, media, or frames require an exact
HTTPS origin in capabilities.network.origins. They work only in the published canvas β the
edit-mode preview blocks direct network access regardless of declaration. Stylesheets from declared
origins are allowed; remote scripts remain blocked, so bundle code with the canvas.
Quill component rules
A PostHog data board must be built entirely from @posthog/quill components β never a native
control or a styled <div> standing in for one:
- Dropdown/picker β
Select(never a native<select>); button βButton(never<button>); text field βInput/Textarea; checkbox βCheckbox; label βLabel. - Table β
Table(TableHeader>TableRow>TableHead, thenTableBody>TableRow>TableCell); panel βCard(CardHeader+CardTitle+CardContent); pill βBadge; titles βHeading; body βText. - A
Tableinside aCardneeds<Card size="sm" flush>around<Table size="sm" fullWidth>. Withoutflushthe card's padding insets the table, so its header and rows stop meeting the card's edges.flushdrops the card's section gap, bottom padding, and theCardContentinline padding, while the header keeps its own padding and divider. Matchingsize="sm"on both lines the table's edge columns up with the card's title. - The only non-Quill tags allowed are plain layout
<div>s andrechartselements. - Quill is built on Base UI: compose compound parts (
Select+SelectTrigger/SelectContent/SelectItem), use controlledvalue+onValueChange, and swap a part's element with therenderprop (e.g.<PopoverTrigger render={<Button β¦/>} />) instead of wrapping it. - Quill components are already themed β never restyle one with Tailwind classes or inline
style; use theirvariant/sizeprops. Put layout utilities (flex,grid,gap-4,p-4) on your own wrapper<div>s. - Buttons: default to
variant="outline";variant="primary"for the one main action only.
Styling and theme
- Give the canvas's outermost element
min-h-screen(min-height: 100vh) so it fills the iframe viewport and grows past it as content demands. Do not useh-screenthere: a fixed viewport height caps a flex column, so tall children shrink and clip instead of scrolling. Do not useh-fullthere either: a published canvas's artifact shell gives itshtml,body, and#rootelements no explicit height, so a percentage root height collapses to content height. - The root needs no
overflow-y-auto: once it grows past the viewport the iframe's own document scrolls. - A
min-heightroot is not a definite height, soh-fullon a direct child still collapses to content height. Give an intermediate wrapper an explicit height (h-[280px]) when a child must fill a box. - Style with Tailwind utilities and Quill components; reserve inline
stylefor genuinely dynamic runtime values (fixed sizes use arbitrary-value utilities likeh-[280px]). - Write specific interface copy. Never use lorem ipsum or placeholder labels in a finished
Pertanyaan umum
Pustaka apa saja yang dapat digunakan?
Pustaka standar seperti React, Quill, Recharts, Lucide, dan Day.js, serta daftar pendek pustaka opsional. Impor lain akan gagal validasi.
Apakah canvas menunggu semua data sebelum menampilkan apa pun?
Tidak. Setiap kartu terisi saat datanya sendiri tiba.
Bisakah menggunakan paket apa pun dari internet?
Tidak. Impor di luar daftar yang diizinkan akan gagal validasi, sehingga hanya pustaka yang disetujui yang dapat digunakan.
Detail
Deskripsi asli dari pembuat
Author the React + Quill implementation of a PostHog canvas: the single-component contract, the allowed imports, Quill (PostHog's design system) component and composition rules, theme-aware design tokens, loading skeletons, and the in-canvas date picker. Use after building-canvases has routed a canvas request to a React implementation β dashboards, data boards, forms, tools, or any canvas that should look native to PostHog.
repo: PostHog/posthog
Popularitas
- Bintang GitHub
- 41k
- Peringkat
- #6840
- Lisensi
- β
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
depot-ci
41kMembantu agent Anda menyiapkan dan menjalankan alur kerja Depot CI, alternatif GitHub Actions, termasuk memigrasikan alur kerja yang ada dan membaca log eksekusi.
depot-container-builds
41kMembantu agent Anda membangun image Docker di builder jarak jauh Depot, termasuk image multi-platform, pengiriman ke registry, dan perbaikan kegagalan build.
depot-github-runners
41kMembantu agent Anda memindahkan job GitHub Actions ke runner yang dikelola Depot, memilih ukuran dan label runner, serta memecahkan masalah pengaturan runner.
editing-agents-md
41kMembantu agent Anda memutuskan apakah sebuah aturan layak masuk ke berkas AGENTS.md atau CLAUDE.md, dan menulisnya agar tetap dipatuhi tanpa membuat berkas membengkak.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.