Command Palette

Search for a command to run...

Docs
Version Badge

Version Badge

用于显示版本号的徽章组件,支持不同的版本格式和样式。

Version Badge 组件用于显示 API 版本号、组件版本或其他版本信息,提供清晰的版本标识。

Loading...

安装

使用方法

import { VersionBadge } from "@/components/pivot/version-badge";
<VersionBadge version="v1.0" />

示例

基本用法

<div className="flex items-center gap-2">
  <VersionBadge version="v1.0" />
  <VersionBadge version="v2.1" />
  <VersionBadge version="v3.0-beta" />
</div>

在 API 文档中使用

<div className="space-y-3">
  <div className="flex items-center gap-3 p-3 border rounded">
    <MethodLabel method="GET" />
    <code className="font-mono">/api/v1/users</code>
    <VersionBadge version="v1.0" />
    <DeprecatedBadge />
  </div>
 
  <div className="flex items-center gap-3 p-3 border rounded">
    <MethodLabel method="GET" />
    <code className="font-mono">/api/v2/users</code>
    <VersionBadge version="v2.0" />
  </div>
</div>

API 参考

Props

属性类型默认值描述
versionstring-版本号
classNamestring-额外的 CSS 类名