TokenTag

The TokenTag component is used to display a token tag with a FluentEmoji icon and a text indicating the remaining tokens.

import { TokenTag } from '@lobehub/ui/chat';

Default

The remaining tokens are calculated based on the maxValue and value props. The component has three types of visual styles: normal, low, and overload, which are determined by the percentage of remaining tokens. The component is memoized for performance optimization.

😀Remained 4,000

APIs

NameDescriptionTypeDefault
displayMode--"remained"|"used""left"
maxValueMaximum value for the tokennumber(required)
shape--"round"|"square"--
text--{overload?:string;remained?:string;used?:string}--
unoptimized--boolean--
valueCurrent value of the tokennumber(required)
refAllows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).|bivarianceHack|RefObject--
key--Key|--