Skip to Content
文档

Kbd

用于显示操作的组合键

SourceStorybookRecipe
Shift + Tab

用法

¥Usage

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

示例

¥Examples

组合

¥Combinations

渲染 Kbd 以展示组合键。

¥Render Kbd to showcase key combinations

ctrl+shift+del

功能键

¥Function Keys

以下是使用 Kbd 展示功能键的示例。

¥Here's an example of using Kbd to showcase function keys

变量

¥Variants

使用 variant 属性更改 Kbd 组件的外观

¥Use the variant prop to change the appearance of the Kbd component

Shift + TabShift + TabShift + TabShift + Tab

尺寸

¥Sizes

使用 size 属性更改 Kbd 组件的大小

¥Use the size prop to change the size of the Kbd component

Shift + TabShift + TabShift + Tab

文本内

¥Within Text

在文本中使用 Kbd 高亮组合键

¥Use Kbd within text to highlight key combinations

Press F12 to open DevTools

属性

¥Props

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

The color palette of the component

variant 'raised'
'raised' | 'outline' | 'subtle' | 'plain'

The variant of the component

size 'md'
'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

链接