Dev Overlay
Floating tabbed dev shell toggled with ⌘/Ctrl+K (or the DEV chip). Plug in TokenCounter, JSON state, logs, or inspectors.
With TokenCounter
Draft textarea plus overlay tabs for token stats and raw state. Toggle with ⌘/Ctrl+K.
The floating control lives in the bottom-right of the viewport (not only this box). Toggle with ⌘ / Ctrl + K.
default-example.tsx
1"use client";23import { useState } from "react";4import { DevOverlay, TokenCounter } from "@/registry/ui";5import { Textarea } from "@/components/ui/textarea";6import { Label } from "@/components/ui/label";78export function DevOverlayDefaultExample() {9 const [text, setText] = useState(10 "Use ⌘K / Ctrl+K to toggle the overlay. One tab shows TokenCounter; the other mirrors local state as JSON.",11 );1213 return (14 <div className="relative mx-auto min-h-[420px] w-full max-w-2xl space-y-3 rounded-lg border border-dashed border-border p-4">15 <p className="text-muted-foreground text-sm">16 The floating control lives in the bottom-right of the viewport (not only17 this box). Toggle with{" "}18 <kbd className="rounded border bg-muted px-1.5 py-0.5 font-mono text-xs">19 ⌘20 </kbd>{" "}21 /{" "}22 <kbd className="rounded border bg-muted px-1.5 py-0.5 font-mono text-xs">23 Ctrl24 </kbd>{" "}25 +{" "}26 <kbd className="rounded border bg-muted px-1.5 py-0.5 font-mono text-xs">27 K28 </kbd>29 .30 </p>31 <div className="space-y-2">32 <Label htmlFor="dev-overlay-textarea">Draft</Label>33 <Textarea34 id="dev-overlay-textarea"35 value={text}36 onChange={(e) => setText(e.target.value)}37 rows={8}38 className="font-mono text-sm"39 />40 </div>4142 <DevOverlay43 defaultTab="tokens"44 tabs={[45 {46 id: "tokens",47 label: "Tokens",48 content: (49 <div className="space-y-3">50 <TokenCounter value={text} maxTokens={512} />51 <p className="text-muted-foreground">52 Pair with prompts, chat inputs, or RAG context editors.53 </p>54 </div>55 ),56 },57 {58 id: "state",59 label: "State",60 content: (61 <pre className="overflow-x-auto rounded-md border border-border bg-muted/40 p-3 text-[11px] leading-relaxed">62 {JSON.stringify(63 { length: text.length, preview: text.slice(0, 120) },64 null,65 2,66 )}67 </pre>68 ),69 },70 ]}71 />72 </div>73 );74}
Installation & source
Install via the shadcn CLI or copy the registry files manually.
bash
npx shadcn@latest add @tt-ui/dev-overlay
Props
| Name | Type | Default | Description |
|---|---|---|---|
| tabs | DevOverlayTab[] | Required | Each tab has id, label, and content (React node) |
| defaultTab | string | First tab id | Initially selected tab id |
| className | string | undefined | Applied to the FAB or the open panel shell |