TokenMeter
Context/usage meter that turns orange above 70% and red above 90%.
Code
import * as React from 'react';
import { TokenMeter } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
maxWidth: 280,
}}
>
<TokenMeter used={150000} limit={200000} label="Context" />
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { TokenMeter } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/token-meter.jsonGuidelines
- Show near the prompt or in the conversation header.
Props
| Prop | Type | Required |
|---|---|---|
used | number | Yes |
limit | number | Yes |
label | string | No |
className | string | No |