
Building React + Quill Canvases
FreeCreate PostHog canvases with React and Quill components.
Free · Opens the source repo
What Building React + Quill Canvases does
Building React + Quill Canvases is a specialized skill designed for developers working with PostHog's canvas feature. This skill provides a clear framework for implementing a single React component that adheres to PostHog's design principles. The main component, src/canvas.tsx, is structured to ensure that it exports a single React component without props, which is essential for seamless integration into PostHog's ecosystem. By following the provided scaffold, developers can efficiently set up their canvases with the necessary components and styling rules.
The skill emphasizes the use of PostHog's design system, Quill, which includes a variety of pre-defined UI components that must be utilized instead of native HTML elements. This ensures a consistent look and feel across all canvases. Developers are guided on how to properly import and use specific libraries, such as @posthog/quill for UI elements, recharts for data visualization, and dayjs for date handling. The strict import rules help maintain code integrity and prevent validation errors.
Styling is another key aspect of this skill. It leverages Tailwind utilities alongside Quill components, ensuring that the canvas adapts to the user's PostHog theme. Developers are instructed on how to manage loading states, error handling, and the rendering of empty states effectively, which enhances the user experience. The skill also includes specific guidelines for implementing a date picker, ensuring that the canvas remains functional and user-friendly.
This skill is ideal for developers who are building data boards, dashboards, or any interactive tools within the PostHog platform. It provides a comprehensive set of rules and best practices that streamline the development process, allowing for quick and effective implementation of PostHog's canvas features.
When to use it
Use this skill when developing interactive canvases for PostHog that require a consistent design and functionality.
When not to use it
This skill is not suitable for projects outside the PostHog ecosystem or for those not using React and Quill components.
What you can build with it
Creating a Data Dashboard
Utilize this skill to build a data dashboard in PostHog that visualizes metrics using Quill components.
Implementing a Form Tool
Use the skill to create a form tool within a PostHog canvas, ensuring it follows the design guidelines.
Building Interactive Reports
Leverage this skill to develop interactive reports that display data insights using PostHog's canvas features.
How to install Building React + Quill Canvases
View source1. Install with the skills CLI
npx skills add posthog/posthog/building-react-quill-canvases --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by posthogBuilding 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-card skeletons, and correct typed-node result reading. Keep that wiring; replace the sample metric and layout.
Imports
Import only from: react, react-dom, react-dom/client, @posthog/quill, recharts,
lucide-react, dayjs. Anything else — including dynamic import(), require(), fetch(),
<script> tags, or remote code — fails validation. Use @posthog/quill for UI, recharts for
charts, lucide-react for icons, dayjs for dates.
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. - 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
- Style with Tailwind utilities and Quill components; reserve inline
stylefor genuinely dynamic runtime values (fixed sizes use arbitrary-value utilities likeh-[280px]). - The canvas follows the user's PostHog theme; a
.darkclass on the document root flips at runtime. Color only from the design-token utilities — surfacesbg-background bg-card bg-muted bg-primary bg-success bg-warning bg-info bg-destructive; texttext-foreground text-muted-foreground text-card-foreground; bordersborder-border. Never a hardcoded hex or light-only color. - Status tokens invert the usual convention: the bare token (
bg-success) is a pale background fill and-foreground(text-success-foreground) is the strong readable color. Colored text or icons always use the-foregroundutility; a filled pill pairsbg-success text-success-foreground. Prefer the QuillBadge(variant="success"/"destructive") for deltas so you don't hand-pick. bg-secondary,text-secondary,bg-accent, andbg-popoverare not defined in the canvas — avoid them.- recharts strokes/fills use token CSS variables (
stroke="var(--primary)", grid/axes invar(--border)/var(--muted-foreground)). - Write Unicode glyphs (curly quotes, ellipsis, arrows, emoji) as literal characters in JSX —
\uXXXXescapes render verbatim in JSX text.
Loading, error, and empty states
Every data point renders a skeleton in its own Card while loading or refreshing: SkeletonText
(matching lines and text-size className) for text/number values, Skeleton for blocks/charts.
Drive isLoading off the data calls and set it true again on refresh; never show a blank or a
jumping layout.
A failed query and an empty result are different states — never let one render as the other.
.catch on every ph.query/ph.loadInsight must set an error state that renders visibly (the
message plus a Retry button wired to the refresh nonce, as in the starter scaffold), not fall
through to zeros, an empty chart, or a "no data yet" message. A query that silently swallows its
error makes real breakage (a missing table, an auth failure, a bad query) look like missing data.
Reserve the empty state for a query that succeeded with no rows.
Date window
A data board owns its own date control — render Quill's DateTimePicker (never a custom Select or
native date input) inside a Popover whose trigger is a Quill Button. PopoverContent gets
exactly className="w-auto p-0" and nothing is added to DateTimePicker beyond
value/onApply/onCancel (it self-sizes; don't pass compact or widths). Re-run every query
when the window changes — see the querying-canvas-data skill for feeding it into dateRange.
Frequently asked questions about Building React + Quill Canvases
Similar skills
Playwright Component Testing
Test React and Vue components in isolation with Playwright.
Fluent UI Blazor
Integrate Fluent UI components in Blazor applications effortlessly.
Build MCP App
Create interactive UI widgets for MCP servers.
Web Design Reviewer
Identify and fix design issues in websites efficiently.
Markstream Install
Seamlessly integrate Markstream for Markdown rendering.
GSAP & Framer Scroll Animation
Create advanced scroll animations effortlessly.
