Skip to Content
文档

徽章

用于高亮项目的状态以便快速识别。

SourceStorybookRecipe
DefaultSuccessRemovedNew

用法

¥Usage

import { Badge } from "@chakra-ui/react"
<Badge>Badge</Badge>

示例

¥Examples

图标

¥Icon

直接在徽章内渲染图标

¥Render an icon within the badge directly

NewNew

变量

¥Variants

徽章有不同的变体

¥Badges come in different variants

OutlineSolidSubtleSurface

尺寸

¥Sizes

徽章有不同的尺寸

¥Badges come in different sizes

NewNewNewNew

属性

¥Props

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink'

The color palette of the component

variant 'subtle'
'solid' | 'subtle' | 'outline' | 'surface' | 'plain'

The variant of the component

size 'sm'
'xs' | 'sm' | 'md' | 'lg'

The size of the component

as
React.ElementType

The underlying element to render.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.

Previous

头像

Next

卡片