Tutorial 1: Hello World
This tutorial walks you through the absolute minimum needed to see something render in Tango. By the end you’ll have a sidebar panel showing a greeting.
1. Scaffold
Section titled “1. Scaffold”bunx github:MartinGonzalez/tango-create# Enter "hello-world" as the directory name, skip backendcd hello-world2. Write the panel
Section titled “2. Write the panel”Replace src/index.tsx with:
import { defineReactInstrument, useInstrumentApi, UIRoot, UIPanelHeader, UISection, UICard } from "tango-api";
function SidebarPanel() { const api = useInstrumentApi();
return ( <UIRoot> <UIPanelHeader title="Hello World" subtitle={api.instrumentId} /> <UISection title="Greeting"> <UICard> <p>Hello from my first instrument!</p> </UICard> </UISection> </UIRoot> );}
export default defineReactInstrument({ defaults: { visible: { sidebar: true }, }, panels: { sidebar: SidebarPanel, },});3. Run it
Section titled “3. Run it”bun run devOpen Tango — your “Hello World” panel appears in the sidebar.
What just happened
Section titled “What just happened”Let’s break down the key pieces:
defineReactInstrument
Section titled “defineReactInstrument”This is the entry point for React-based instruments. It wraps your components with the API provider and handles mounting/unmounting:
export default defineReactInstrument({ defaults: { visible: { sidebar: true }, // sidebar starts visible }, panels: { sidebar: SidebarPanel, // React component for the sidebar slot },});The defaults.visible object controls which panels are shown by default. Users can toggle panel visibility later.
useInstrumentApi
Section titled “useInstrumentApi”This hook gives you the full InstrumentFrontendAPI object:
const api = useInstrumentApi();Through api you can access:
api.instrumentId— your instrument’s unique IDapi.storage— key-value, file, and SQLite storageapi.sessions— start/stop Claude sessionsapi.events— subscribe to host eventsapi.actions— call backend actionsapi.emit()— emit custom eventsapi.settings— read/write instrument settings
UIRoot
Section titled “UIRoot”Every panel should be wrapped in UIRoot. This component injects the Tango UI stylesheet so all tui-* components render with the correct theme:
<UIRoot> {/* your panel content */}</UIRoot>UIPanelHeader
Section titled “UIPanelHeader”A standardized header with title, optional subtitle, optional back button, and optional right-side actions:
<UIPanelHeader title="Hello World" subtitle="sidebar panel" rightActions={<UIBadge label="v1" tone="info" />}/>Next steps
Section titled “Next steps”Your panel is static right now. In the next tutorial you’ll use more UI components to build interactive interfaces.