building-react-quill-canvases
O que ela faz
Esta skill cria canvas interativos, como painéis, quadros de dados e ferramentas, usando React e o próprio sistema de design do PostHog. É para quem quer um canvas no estilo de aplicativo que combine com o visual do PostHog.
Quando usar
- ✓Quando você quer um painel ou quadro de dados interativo dentro do PostHog.
- ✓Quando você precisa de um formulário, uma ferramenta ou um canvas no estilo de aplicativo com botões e campos.
- ✓Quando um canvas precisa combinar com o visual do PostHog nos temas claro e escuro.
Link da skill
https://github.com/PostHog/posthog/blob/master/products/canvas/skills/building-react-quill-canvases/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Crie um canvas interativo com um seletor de data e três cartões de métricas para usuários em teste.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A IA escreve um único componente React que o PostHog monta, usa os componentes e as importações permitidos e carrega cada cartão de dados separadamente. Mantém o tema e os estados de carregamento consistentes com o design do PostHog.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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
Perguntas frequentes
Quais bibliotecas ele pode usar?
Bibliotecas padrão, como React, Quill, Recharts, Lucide e Day.js, além de uma lista curta de opcionais. Outras importações falham na validação.
O canvas espera todos os dados para mostrar algo?
Não. Cada cartão é preenchido assim que os seus dados chegam.
Ele pode usar qualquer pacote da internet?
Não. Importações fora da lista permitida falham na validação, então só bibliotecas aprovadas podem ser usadas.
Detalhes
Descrição original do autor
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
Popularidade
- Estrelas no GitHub
- 41 mil
- Posição no ranking
- #6840
- Licença
- —
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
depot-ci
41 milAjuda seu agente a configurar e executar fluxos de trabalho do Depot CI, uma alternativa ao GitHub Actions, incluindo a migração de fluxos existentes e a leitura dos logs de execução.
depot-container-builds
41 milAjuda seu agente a criar imagens Docker nos builders remotos do Depot, incluindo imagens multiplataforma, envio para registros e correção de falhas de build.
depot-github-runners
41 milAjuda seu agente a levar tarefas do GitHub Actions para runners gerenciados pelo Depot, escolhendo os tamanhos e os rótulos dos runners e resolvendo problemas de configuração.
editing-agents-md
41 milAjuda seu agente a decidir se uma regra deve ficar em um arquivo AGENTS.md ou CLAUDE.md, e a escrevê-la de forma que seja seguida sem deixar o arquivo inchado.
Skills parecidas
angular-developer
280 milAjuda seu agente a criar código Angular e a dar conselhos sobre a estrutura do projeto. É útil para iniciar novos projetos, criar partes do código ou melhorar a performance e acessibilidade.
frontend-a11y
280 milAjuda seu agente a tornar interfaces web acessíveis para todos. Ele garante que sites e apps funcionem bem com leitores de tela e navegação por teclado.
frontend-patterns
280 milFaz seu agente aplicar padrões modernos no desenvolvimento frontend. Ele otimiza performance, gerencia estado e segue boas práticas em React e Next.js.