Buff Bar
Active effects on the HUD. Each buff or debuff is a round icon with a countdown ring, a short time label ("4:32", "2h"), a stacks badge and a tooltip with the name, description, source and time left. Debuffs use the danger colour, and under 10 seconds an icon gently blinks. Timers use absolute end times.
Well fed, a Rainy day debuff, a permanent Festival spirit with 3 stacks and a 12 second Tea break. onExpire removes each buff when its timer ends; the buttons add and refresh. Hover, focus or tap an icon.
Hover or focus an icon for details.
Installation
Usage
Without duration the ring starts full when the buff is first shown and empties until endsAt.
Tooltips open on hover and keyboard focus; a tap opens and closes them on touch screens. The component has its own TooltipProvider.
Reduced motion stops the blink and the ring transition.
Examples
Sizes, overflow and vertical
size, max with a "+n" chip that lists the rest, orientation="vertical" and sort="none".
API
Everything else is passed through to the underlying element or Radix primitive.
| Prop | Type | Default | Description |
|---|---|---|---|
buffs | Buff<T>[] | – | { id, name, label?, icon?, description?, kind?, stacks?, endsAt?, duration?, source?, data? }. No endsAt means permanent. `icon` is a React node or an image URL. |
onExpire | (buff) => void | – | Called once when a timer reaches 0. Remove the buff from `buffs`; until then it is hidden. |
onSelect | (buff) => void | – | Makes the icons buttons. |
max | number | all | Icons shown; the rest go into a "+n" chip with a tooltip list. |
size | "sm" | "md" | "lg" | "md" | 40, 52 or 64 px icons. |
orientation | "horizontal" | "vertical" | "horizontal" | Direction of the row. |
sort | "time" | "none" | "time" | "time": debuffs first, then the soonest to end, permanent last. "none" keeps your order. |
emptyText | ReactNode | – | Shown when empty. Without it the component renders nothing. |
labels | Partial<BuffBarLabels> | English | bar, timeLeft ("{time} left"), permanent, debuff, source, more ("{count} more effects"). |