Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Menubar
- Message
- Meter
- Number Field
- OTP Field
- Pagination
- Popover
- Preview Card
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Toolbar
- Tooltip
Shared
- Artifact
- Audio Player
- Canvas
- Chain of Thought
- Checkpoint
- Code Block
- Commit
- Connection
- Context
- Controls
- Edge
- Environment Variables
- Mic Selector
- Model Selector
- Node
- Node Toolbar
- Open in Chat
- Panel
- Plan
- Prompt Input
- Queue
- Reasoning
- Sandbox
- Schema Display
- Shimmer
- Snippet
- Sources
- Speech Input
- Stack Trace
- Suggestion
- Tool
- Transcription
- Web Preview
Hooks
Resources
Context
A breakdown of a model's token context usage.
import {
Context,
ContextCacheUsage,
ContextContent,
ContextContentBody,
ContextContentFooter,
ContextContentHeader,
ContextInputUsage,
ContextOutputUsage,
ContextReasoningUsage,
ContextTrigger,
} from "@/registry/default/shared/context";
const usage = {
inputTokenDetails: {
cacheReadTokens: 8000,
cacheWriteTokens: 1200,
noCacheTokens: 24_000,
},
inputTokens: 32_000,
outputTokenDetails: { reasoningTokens: 1800, textTokens: 2400 },
outputTokens: 4200,
totalTokens: 46_000,
};
export default function Particle() {
return (
<Context
maxTokens={200_000}
modelId="anthropic:claude-opus-4"
usage={usage}
usedTokens={46_000}
>
<ContextTrigger />
<ContextContent>
<ContextContentHeader />
<ContextContentBody>
<ContextInputUsage />
<ContextOutputUsage />
<ContextReasoningUsage />
<ContextCacheUsage />
</ContextContentBody>
<ContextContentFooter />
</ContextContent>
</Context>
);
}
Installation
pnpm dlx shadcn@latest add @frontal-labs/context
Usage
import {
Context,
ContextTrigger,
ContextContent,
ContextContentHeader,
ContextContentBody,
ContextContentFooter,
ContextInputUsage,
ContextOutputUsage,
} from "@/components/context";API Reference
| Export | Props |
|---|---|
Context | HoverCard props, plus ContextSchema |
ContextTrigger | Button props |
ContextContent | HoverCardContent props |
ContextContentHeader | <div> attributes |
ContextContentBody | <div> attributes |
ContextContentFooter | <div> attributes |
ContextInputUsage | <div> attributes |
ContextOutputUsage | <div> attributes |
ContextReasoningUsage | <div> attributes |
ContextCacheUsage | <div> attributes |
Open the source under Manual above for the exact prop types.
On This Page