Character Info

A character sheet: portrait with level, name and title, XP, bars for health, energy or mood, status chips, attributes with gear bonuses and equipment slots. A compact variant fits a HUD or party list.

View as Markdown

Equipment slots show item tooltips and call onEquipmentSelect. Locked slots are dashed.

12

Mai

Rice farmerRare
XP640 / 1000
Health82 / 100
Energy35 / 60
MoodCheerful
  • Well fed
  • Rain soon
Wakes before the roosters. Knows every paddy by name.
Strength
12+2
Craft
9
Charm
14+3
Luck
7
Head
Tool
Charm
Pet

Installation

npx shadcn@latest add @cozy/character-info

Usage

import { CharacterInfo } from "@/components/ui/character-info"

<CharacterInfo character={{ name: "Mai", level: 12, bars: [{ id: "hp", label: "Health", value: 82, max: 100 }] }} />

Examples

Compact party

variant="compact" keeps portrait, name, level and bars.

12

Mai

Rice farmer
Health82 / 100
Energy35 / 60
9

Bao

Fisher
Health40 / 90
Energy50 / 60
15

Lan

Lantern maker
Health70 / 70
Energy12 / 60

API

Everything else is passed through to the underlying element or Radix primitive.

PropTypeDefaultDescription
characterCharacter–{ name, title?, portrait?, level?, xp?, rarity?, bars?, attributes?, status?, equipment?, description? }.
variant"full" | "compact""full"Compact shows portrait, name, title, XP and bars only.
onEquipmentSelect / selectedEquipment(slot) => void / string–Click on an equipment slot, and highlight one (e.g. where a selected item would go).
bars[].tone"success" | "info" | "reward" | "primary" | "danger" | CSS colour"success"Bar colour.
attributes[].bonusnumber–Shown as +n in green or -n in red next to the value.
actions / children / renderPortraitReactNode / fn–Buttons under the card, extra sections, or your own portrait (a sprite, a 3D canvas).
slotSize / tooltip / raritiesnumber / boolean / Record56 / trueEquipment tile size, item tooltips and custom rarities.