🔥 认识我们的新项目 t0ggles - 你最终的项目管理工具! 🔥

进度条 React 组件

除了 加载动画 之外,还有一个确定性进度条来指示活动。

进度条组件

以下是一些包含的组件

  • 进度条

进度条属性

名称类型默认值描述
colors对象

包含 Tailwind CSS 颜色类的对象

colors.bgIos字符串'bg-primary'
colors.bgMaterial字符串'bg-md-light-primary dark:bg-md-dark-primary'
component字符串'span'

组件的 HTML 元素

progress数字0

确定性进度(从 0 到 1)

示例

Progressbar.jsx
import React, { useState } from 'react';
import {
Page,
Navbar,
NavbarBackLink,
Block,
BlockTitle,
Progressbar,
Segmented,
SegmentedButton,
} from 'konsta/react';
export default function ProgressbarPage() {
const [progress, setProgress] = useState(0.1);
return (
<Page>
<Navbar
title="Progressbar"
/>
<BlockTitle>Determinate Progress Bar</BlockTitle>
<Block strong insetMaterial outlineIos>
<div className="my-4">
<Progressbar progress={progress} />
</div>
<Segmented raised>
<SegmentedButton
active={progress === 0.1}
onClick={() => setProgress(0.1)}
>
10%
</SegmentedButton>
<SegmentedButton
active={progress === 0.3}
onClick={() => setProgress(0.3)}
>
30%
</SegmentedButton>
<SegmentedButton
active={progress === 0.5}
onClick={() => setProgress(0.5)}
>
50%
</SegmentedButton>
<SegmentedButton
active={progress === 1.0}
onClick={() => setProgress(1.0)}
>
100%
</SegmentedButton>
</Segmented>
</Block>
<BlockTitle>Colors</BlockTitle>
<Block strong insetMaterial outlineIos className="space-y-4">
<Progressbar className="k-color-brand-red" progress={0.25} />
<Progressbar className="k-color-brand-green" progress={0.5} />
<Progressbar className="k-color-brand-yellow" progress={0.75} />
<Progressbar className="k-color-brand-purple" progress={1} />
</Block>
</Page>
);
}
代码许可证 MIT.
2022 © Konsta UI 由 nolimits4web.