adding-dashboard-v2-custom-content
Skill733 starsChanged 5 days agoMITView on GitHub
Guides putting a product's own React component in a dashboards v2 tile through the custom panel type: a content package in the product's folder (`defineContentPackage`), `createCustomPanel({ packages })`, the off-by-default opt-ins (`movable`, `duplicable`, `backgroundColor`, `menuActions`, `showOnInteractiveOnly`) and reading or changing the dashboard's filters. Use when migrating an existing component, banner, list or prompt from a product page into a dashboards v2 tile, adding a new custom content, or reviewing a diff that touches a content package. Not for a new kind of chart or panel type (`adding-dashboard-v2-panel-types`).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- PostHog/posthogword for word, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 1
- PostHog/posthog★ 41k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository131 other files it gives its agents.
- AGENTS.mdAGENTS.md
- common/AGENTS.mdAGENTS.md
- hog/AGENTS.mdAGENTS.md
- proto/AGENTS.mdAGENTS.md
- rust/AGENTS.mdAGENTS.md
- .cursor/rules/django-python.mdcCursor rule
- .cursor/rules/react-typescript.mdcCursor rule
- .cursor/rules/rust.mdcCursor rule
- adding-activity-loggingSkill
- adding-api-scopesSkill
- adding-dashboard-v2-panel-typesSkill
- adding-inbound-webhooksSkill
- adding-inbox-sourcesSkill
- adding-ingestion-warningsSkill
- adding-mcp-store-serversSkill
- adding-personhog-rpcSkill
- adding-product-alertingSkill
- adding-project-secret-api-key-authSkill
- adding-today-highlightsSkill
- adopting-generated-api-typesSkill
- analyzing-experiment-precompute-canarySkill
- analyzing-experiment-query-performanceSkill
- analyzing-insights-across-teamsSkill
- announcing-behavior-changesSkill
- auditing-warehouse-source-coverageSkill
- authenticating-to-clickhouseSkill
- authoring-ci-workflowsSkill
- building-on-capture-v1Skill
- building-product-empty-statesSkill
- building-the-toolbarSkill
- calling-the-ai-gatewaySkill
- clickhouse-migrationsSkill
- creating-customer-analytics-account-widgetsSkill
- debugging-ci-failuresSkill
- debugging-local-replaySkill
- debugging-local-task-agent-runsSkill
- debugging-mcp-analyticsSkill
- debugging-signals-pipelineSkill
- debugging-table-access-deniedSkill
- depot-ciSkill
- depot-container-buildsSkill
- depot-github-runnersSkill
- developing-subscriptionsSkill
- developing-the-cliSkill
- django-migrationsSkill
- django-startup-timeSkill
- documenting-warehouse-sourcesSkill
- editing-agents-mdSkill
- establishing-code-ownershipSkill
- exporting-recordings-to-customer-s3Skill
- extending-hobby-smoke-testsSkill
- extending-personhog-test-harnessSkill
- extending-the-admin-consoleSkill
- fixing-flaky-testsSkill
- formatting-slack-messagesSkill
- gating-production-deploysSkill
- gating-sensitive-actionsSkill
- generating-clickhouse-query-performance-reportsSkill
- hogliSkill
- implementing-mcp-toolsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Read products/dashboards_v2/.agents/composing.md ("Your own component in a tile") and .agents/primitives.md first.
- Very specific: line 43
Never read DashboardStateContext or a context from the page the component came from.
- Distinctive: line 60
Every control works and changes the dashboard's filters or time range when it should.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Adding custom content to a dashboards v2 tile
A custom content is a product's own React component shown in a tile.
The tile draws the frame (title, menu, error boundary), and the document saves only the content's name, such as { type: 'custom', config: { content: 'web-analytics/browser-filter' } }.
Read products/dashboards_v2/.agents/composing.md ("Your own component in a tile") and .agents/primitives.md first.
Decide it is custom content
- The component draws the result of a query as a chart, number or table: make it a chart kind instead, as
composing.mddescribes in "Your own kind of chart". Charts get sample data, filters, image export and the chart menu for free. - It is not a query result, or it needs its own interaction, such as a setup prompt, a checklist, a list with actions or a control that changes the dashboard's filters: make it custom content.
Migrate a component
- Find or create the product's package. One per product, in that product's own folder, such as
products/web_analytics/frontend/dashboard/webAnalyticsContents.ts(use/placing-product-frontend-codewhen unsure). The namespace is the product's name in kebab case. It is saved in every document that uses the content, so pick it once and never rename it. Add the content with a short name.
const BrowserFilter = lazy(() => import('./BrowserFilter').then((module) => ({ default: module.BrowserFilter }))) export const webAnalyticsContents = defineContentPackage('web-analytics', { 'browser-filter': { Component: BrowserFilter, size: { w: 8, h: 8, minW: 6, minH: 6 } }, })Load the component with
React.lazy, so code that only checks documents never loads it. The name is saved in documents too: renaming one breaks saved dashboards.- Decide what the tile sets. A value that differs between two tiles of the same content, such as which service a list shows, is a prop: wrap the content in
defineContentwith apropsSchema(az.strictObject), and the tile saves the values inconfig.props. The prop names are saved in documents, so renaming one breaks saved dashboards. Everything else is not a prop:- Data it loaded from its scene's props or logic comes from a logic keyed on what the component can read itself, such as the current team.
- The dashboard's time range and filters come from
FiltersContext. - A control that changes them uses the controllers in
FilterControlsContext. Each is missing when the dashboard has none, so disable the control with adisabledReasonthen. - Never read
DashboardStateContextor a context from the page the component came from.
- Strip its own frame. Remove the component's card, border, padding that matches the card's, and its title. The tile draws them, and the tile's
titleholds the heading. Hide the tile header withparts: { header: false }when the content has its own, such as a callout. - Fill the tile. The content gets the tile's height. A list or table scrolls inside itself, and nothing sets a fixed height. Pick
sizeso the default tile shows the content without a scrollbar. - Give it a
Loadingshaped like the content when it loads data, so an off-screen tile looks like itself. Left out, the tile shows the default loading state. - Opt in only to what the product wants people to do. By default a content cannot be moved and has an empty menu.
movable: truelets a person drag, resize, move and remove the tile.duplicable: trueadds Duplicate to the tile's menu.backgroundColor: trueadds Background to the tile's menu, whatevermenuActionsreturns. To color the tile from the component's own state instead, calluseTileBackground(color)with one ofTILE_BACKGROUND_COLORSor any CSS color.menuActions(actions, context)returns the built-in actions to show, such asactions.filter((action) => action.key === 'download'). Left out, the menu is empty.keepMounted: truekeeps the component mounted after it scrolls out of view. Set it when the component holds state a person would lose, such as a picked tab or a draft, and leave it out otherwise, because the tile then stays in memory.showOnInteractiveOnly: trueleaves the tile out of images and printed pages. Use it for prompts, buttons and live counters, which mean nothing in a snapshot.
- Register the package in the host's panel list,
createCustomPanel({ packages: [webAnalyticsContents] }), and add the tile to the dashboard JSON. A product page passes only its own package: products never import another product's package.
Before you report done
- The tile renders on the host page, with no "not valid" message and no scrollbar at its default size.
- A content with a
propsSchemarenders from the props its tile saved, and a tile with a wrong prop shows the "not valid" message. - Every control works and changes the dashboard's filters or time range when it should.
- The tile has no drag handle or menu entries unless the content opted in.
- An image download leaves out the content when
showOnInteractiveOnlyis set. - The old component's other callers still work, or were moved to the content.
pnpm --filter=@posthog/frontend typescript:checkand the touched Jest tests pass.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

