Complete guide to using the TOON format viewer components.
npm install @programsmagic/toon-viewer
import { FormatViewer } from '@programsmagic/toon-viewer';
import '@programsmagic/toon-viewer/styles';
function App() {
return (
<FormatViewer
initialContent='{"user": {"id": 123, "name": "Ada"}}'
initialFormat="json"
showTokenCounter={true}
llmMode={true}
/>
);
}
Main split-pane viewer component.
Props:
initialContent (string): Initial contentinitialFormat (SupportedFormat): Initial formatshowTokenCounter (boolean): Show token countershowFormatSelector (boolean): Show format selectorllmMode (boolean): LLM-grade mode (copy as fenced block)model (string): Model for token countingonContentChange (function): Content change callbackDrag & drop file upload component.
Props:
onFileLoad (function): File load callbackacceptedFormats (string[]): Accepted file formatsToken count display component.
Props:
tokens (number): Token countmodel (string): Model nameestimatedCost (object): Estimated costlabel (string): Label textEnable LLM-grade mode for optimized prompt copying:
<FormatViewer
llmMode={true}
// Copies as: ```toon\ncontent\n```
/>
MIT