Progress

维护者:
Lunory
GitHub
theme
value
text
size
loading
import {Progress} from '@gravity-ui/uikit';

Progress 组件显示当前操作进度。它也可以分为几个部分。

主题

使用该 theme 属性指定整个进度或复合部分的颜色:

default
default
success
success
warning
warning
danger
danger
info
info
misc
misc
<Progress text="default" value={50} />
<Progress text="warning" theme="warning" value={50} />
<Progress text="info" theme="info" value={50} />
<Progress text="success" theme="success" value={50} />
<Progress text="danger" theme="danger" value={50} />
<Progress text="misc" theme="misc" value={50} />

国家

Loading
Loading
<Progress text="Loading" theme="misc" value={60} loading={true} />

大小

要管理 Progress 组件的大小,请使用可以取以下值的 size 属性: "xs" "s" 、和 "m"。该 text 属性仅适用于大 "m" 小。

<Progress theme="success" value={60} size="xs" />
<Progress theme="warning" value={70} size="s" />
<Progress theme="danger" value={80} size="m" />

断点

使用该 colorStops 属性设置 Progress 组件的断点。

<Progress
  value={10}
  colorStops={[{theme: 'danger', stop: 20}, {theme: 'warning', stop: 50}, {theme: 'success', stop: 100}]}
/>
<Progress
  value={40}
  colorStops={[{theme: 'danger', stop: 20}, {theme: 'warning', stop: 50}, {theme: 'success', stop: 100}]}
/>
<Progress
  value={60}
  colorStops={[{theme: 'danger', stop: 20}, {theme: 'warning', stop: 50}, {theme: 'success', stop: 100}]}
/>

堆栈

First
Second
Third
Fourth
Progress with custom colors
Progress with custom colors
<Progress
  stack={[
    {theme: 'default', content: 'First', value: 25},
    {theme: 'success', content: 'Second', value: 25},
    {theme: 'warning', content: 'Third', value: 25},
    {theme: 'danger', content: 'Fourth', value: 25},
  ]}
/>
<Progress text="Progress with custom colors"
  stack={[
    {color: '#6e5d8c', value: 33.333333333333336},
    {color: '#5b785b', value: 33.333333333333336},
    {color: '#956069', value: 33.333333333333336},
  ]}
/>

属性

姓名描述类型默认
classNameHTML class 属性string
colorStops使用主题设置断点数组<{theme: string; stop: number;}>
colorStopsValue设置用于选择 ColorStops 的当前停靠点或替代值的值。可用范围介于 0 到 100 之间。number
加载中切换 loading 状态booleanfalse
尺寸设置进度条大小。进度栏文本只能按大 "m" 小显示。string"m"
复合进度条的配置。如果提供了, value 则不是必填项。数组<Stack>
stackClassName堆栈 class 的 HTML 属性string
文本进度栏内的文字ReactNode
主题设置进度颜色string"default"
价值当前进度值。可用范围介于 0 到 100 之间。使用该 stack 属性值是可选的,用作最大值。number

Stack

姓名描述类型默认
classNameclass 堆栈元素的 HTML 属性string
颜色设置 style HTML 属性的背景颜色string
内容堆栈元素内容ReactNode
标题title HTML 属性string
主题设置堆栈元素的颜色string"default"
价值当前进度值。可用范围介于 0 到 100 之间。使用该 stack 属性值是可选的,用作 maxValuenumber
qadata-qa HTML 属性,用于测试string

CSS API

姓名描述
--g-progress-empty-text-color空白的 Progress 文字颜色
--g-progress-filled-text-color填充的 Progress 文字颜色
--g-progress-empty-background-color空白的 Progress 背景颜色
--g-progress-filled-background-color填充的 Progress 背景颜色