CodePreview
Interactive demo panel with toolbar, preview canvas, and collapsible source.
Example
tsx
import { Button } from '@toucan-ui/react';
export function Demo() {
return <Button variant="primary">Save changes</Button>;
}Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
code | string | — | Required | Source code content |
language | string | — | No | Language label for the source block |
toolbar | ReactNode | — | No | Optional demo controls |
showCode | boolean | — | No | Whether source is visible |
onToggleCode | () => void | — | No | Toggle handler for source view |
children | ReactNode | — | No | Preview content |