文档目录
快捷栏
原版 182×22、9 个 20×20 槽位的快捷栏。
import { Hotbar } from "./index";
/**
* Hotbar 预览用例(规格 §6.1)
*/
export function HotbarDemo() {
return (
<Hotbar
items={[
{ count: 64, icon: "stone-block", tooltip: "石头 ×64" },
{ icon: "grass-block" },
{ count: 12, icon: "diamond", tooltip: "钻石 ×12" },
{ icon: "sword", tooltip: "铁剑" },
{ count: 5, icon: "apple", tooltip: "苹果 ×5" },
{},
{ icon: "experience-bottle" },
{},
{ icon: "gunpowder" },
]}
selectedIndex={2}
/>
);
}
安装
CLI 拷贝
$npx shadcn add @tennantite/hotbarnpm 直装
$pnpm add @tennantite/uinpm 方式安装编译产物;需要改造源码请用上方的 CLI 拷贝安装。
源码
packages/ui/src/screens/hud/hotbar/index.tsxnpm 包保留源码目录,可直接复制改造。