Skip to Content
文档

旋转器

用于提供操作正在处理的视觉提示

SourceStorybookRecipe

用法

¥Usage

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

示例

¥Examples

尺寸

¥Sizes

使用 size 属性更改加载控件的大小。

¥Use the size prop to change the size of the spinner.

颜色

¥Colors

使用 colorPalette 属性更改旋转器的配色方案。

¥Use the colorPalette prop to change the color scheme of the spinner.

自定义颜色

¥Custom Color

使用 color 属性将自定义颜色传递给旋转器。

¥Use the color prop to pass a custom color to the spinner.

轨道颜色

¥Track Color

使用 --spinner-track-color 变量更改旋转器轨道的颜色。

¥Use the --spinner-track-color variable to change the color of the spinner's track.

自定义速度

¥Custom Speed

使用 animationDuration 属性更改旋转器的速度。

¥Use the animationDuration prop to change the speed of the spinner.

粗细

¥Thickness

使用 borderWidth 属性更改旋转器的粗细。

¥Use the borderWidth prop to change the thickness of the spinner.

标签

¥Label

编写带有标签的加载控件,以提供更多上下文。

¥Compose the spinner with a label to provide additional context.

Loading...

叠加

¥Overlay

组合旋转器与 AbsoluteCenter 组件,使其叠加在另一个组件之上。

¥Compose spinner with the AbsoluteCenter component to overlay the spinner on top of another component.

Some heading text

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac consectetur libero, id ultricies urna. Sed ac consectetur libero, id fames ac ante ipsum primis in faucibus.

属性

¥Props

根元素

¥Root

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

The color palette of the component

size 'md'
'inherit' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'

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

状态