Custom Visuals
Build custom React visualizations and filters for Semaphor dashboards
Custom visuals let you bring your own React components into Semaphor dashboards. Build charts, tables, KPIs, maps, or any visualization your users need.
Semaphor handles data fetching, authentication, theming, and state management. You focus on the visualization.
Why Custom Plugins?
Standard chart libraries often fall short for domain-specific needs:
- Trade Analytics: Specialized maps with import/export flows and custom annotations
- Financial Dashboards: Tables with precise formatting, sorting, and conditional highlighting
- HR Tools: Demographic visualizations with compliance requirements
- Healthcare: Patient flow diagrams, appointment timelines, resource views
Most BI tools lock you into their charting libraries. Semaphor's plugin architecture gives you complete control.
Micro Frontend Architecture
Plugins follow the micro frontend pattern—small, independently deployable applications that integrate at runtime.
Benefits
| Benefit | Description |
|---|---|
| Independent Deployment | Ship plugin updates without touching Semaphor core |
| Technology Freedom | Use any React-compatible libraries (D3, Recharts, ECharts) |
| Team Autonomy | Different teams can own different visualizations |
| Isolation | Plugin bugs don't crash the main application |
| Lightweight | Only load what you need, when you need it |
What Semaphor Handles vs What You Build
Semaphor handles:
- Security and multi-tenancy
- Authentication and permissions
- Query processing and data fetching
- State management and filter cascading
- Theme synchronization
- Caching and performance
You focus on:
- Your visualization
- Your styling preferences
- Your user experience
Single vs Multi-Input
Choose based on how many data sources your visual needs.
| Type | Use When | Data Shape | Example |
|---|---|---|---|
| Single-Input | One query, one visual | data: Record[] | Charts, tables, KPIs |
| Multi-Input | Combining multiple queries | data: Record[][] | KPI + trend chart, comparison grids |
Most visuals are single-input. Use multi-input when you need to combine data from different cards (like a KPI header with a separate trend chart).
Quick Start
The easiest way to create custom visuals is with Claude Code. The plugin template includes skills that generate complete, working components automatically.
1. Clone the template
2. Create your visual with Claude Code
Open Claude Code in the plugin project and ask it to create your component:
Then describe what you want to build:
Or for multi-input visuals:
Claude will automatically:
- Create the component file with proper TypeScript types
- Create sample data for the Showcase
- Register the component in
components.config.ts - Export from
index.ts - Add to
sample-data-registry.ts
Tips for better results:
- Upload a screenshot — Drag and drop an image of the visual you want. Claude can see the design and replicate it
- Be specific: "A donut chart with center label showing percentage"
- Mention libraries: "Use Recharts for the bar chart"
- Describe interactions: "Clicking a bar should highlight it"
- Specify formatting: "Display currency values with $ prefix"
3. Preview in the Showcase
Open http://localhost:5173 to see the Showcase Gallery with your component.
The Showcase provides:
- Instant Feedback — Hot reload shows changes immediately
- Realistic Testing — Sample data mimics production query results
- Documentation Preview — See how your docs will appear in Semaphor
- Filter Interaction — Test filter components with real state management
4. Build and publish
One-time setup:
During semaphor init, you'll be prompted for:
- Type: Select
Plugin - Name: Your plugin name (e.g.,
my-company-charts) - Build path:
dist(default) - Project ID: From Semaphor project settings
- Project Secret: From Semaphor project settings
Build and publish:
This uploads to Semaphor:
dist/index.js— Bundled componentsdist/style.css— Stylesdist/manifest.json— Component metadata
Your visual now appears in Semaphor's chart type selector under Custom Visuals.
What Claude Creates
When you ask Claude to create a visual, it generates a complete component structure. Here's what each file does:
Project Structure
Key Files
| File | Purpose |
|---|---|
components.config.ts | Registers components with names, settings, icons, and documentation |
index.ts | Exports all components (names must match config exactly) |
[name].tsx | The React component that renders your visualization |
[name].data.ts | Sample data for testing in the Showcase |
Props Your Component Receives
Semaphor passes these props to your component:
Manual Reference
If you prefer to create components without AI assistance, or want to understand the internals for customization, see the detailed guides:
- Single-Input Guide — Step-by-step manual creation
- Multi-Input Guide — Combining multiple data sources
- API Reference — Complete type definitions
Next Steps
Single-Input Guide
Build standard visuals with one data source.
Multi-Input Guide
Combine multiple data sources in one visual.
Custom Filters
Build custom filter UI components.
Number Formatting
Apply currency, percentage, and date formatting.
API Reference
Complete props and types documentation.
Troubleshooting
Common issues and solutions.