4.22.3 • Published 5 months ago

@uiw/react-steps v4.22.3

Weekly downloads
233
License
MIT
Repository
github
Last release
5 months ago

Steps 步骤条

Buy me a coffee Open in unpkg NPM Downloads npm version

引导用户按照流程完成任务的导航条。当任务复杂或者存在先后关系时,将其分解成一系列步骤,从而简化任务。

import { Steps } from 'uiw';
// or
import Steps from '@uiw/react-steps';

基本用法

简单的步骤条。

import React from 'react';
import { Steps } from 'uiw';

export default function Demo() {
  return (
    <Steps current={1} style={{ padding:"20px 0" }}>
      <Steps.Step title="步骤一" description="这里是步骤一的说明,可以很长很长哦。这里是步骤一的说明,可以很长很长哦。这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤二" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤三" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤四" description="这里是步骤一的说明,可以很长很长哦。" />
    </Steps>
  )
}

没有详情介绍

简单的步骤条。

import React from 'react';
import { Steps } from 'uiw';

export default function Demo() {
  return (
    <Steps current={1} style={{padding:"20px 0"}}>
      <Steps.Step title="步骤一" />
      <Steps.Step title="步骤二" />
      <Steps.Step title="步骤三" />
      <Steps.Step title="步骤四" />
    </Steps>
  )
}

带图标的步骤条

通过设置 Steps.Stepicon 属性,可以启用自定义图标。

import React from 'react';
import { Steps, Icon } from 'uiw';

export default function Demo() {
  return (
    <Steps current={1} style={{padding:"20px 0"}}>
      <Steps.Step icon={<Icon type="user"/>} title="注册" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step icon={<Icon type="picasa" spin={true} color="red" />} title="上传头像" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step icon="message" title="验证邮箱" description="这里是步骤一的说明,可以很长很长哦。" />
    </Steps>
  )
}

步骤运行错误

使用 Stepsstatus 属性来指定当前步骤的状态。

import React from 'react';
import { Steps } from 'uiw';

export default function Demo() {
  return (
    <Steps current={2} status="error" style={{padding:"20px 0"}}>
      <Steps.Step title="步骤一" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤二" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤三" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤四" description="这里是步骤一的说明,可以很长很长哦。" />
    </Steps>
  )
}

点状步骤条

包含步骤点的进度条。

import React from 'react';
import { Steps } from 'uiw';

export default function Demo() {
  return (
    <Steps progressDot status="error" current={2} style={{padding:"20px 0"}}>
      <Steps.Step title="步骤一" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤二" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤三" description="这里是步骤一的说明,可以很长很长哦。" />
      <Steps.Step title="步骤四" description="这里是步骤一的说明,可以很长很长哦。" />
    </Steps>
  )
}

步骤切换

通常配合内容及按钮使用,表示一个流程的处理进度。

import React from 'react';
import { Steps, Button, Notify } from 'uiw';

const conStyle = { minHeight: 200, backgroundColor: '#fafafa',textAlign: 'center', borderRadius: 6, paddingTop: 80, marginTop: 15 }
const steps = [
  {
    title: '第一步',
    content: '注册一个账号',
  }, {
    title: '第二步',
    content: '填写个人信息。',
  }, {
    title: '第三步',
    content: '验证邮箱',
  }
]

export default function Demo() {
  const [current, setCurrent] = React.useState(0);
    return (
      <div>
        <Steps current={current}>
          {steps.map(item => <Steps.Step key={item.title} title={item.title} />)}
        </Steps>
        <div style={conStyle}>{steps[current].content}</div>
        <div style={{marginTop: 20}}>
          {current < steps.length - 1 && (
            <Button type="primary" size="small" onClick={() => setCurrent(current + 1)}>下一步</Button>
          )}
          {current === steps.length - 1 && (
            <Button type="primary" size="small" onClick={() => Notify.open({ description: '处理完成!' })}>完成</Button>
          )}
          {current > 0 && (
            <Button size="small" style={{ marginLeft: 8 }} onClick={() => setCurrent(current - 1)}>
              上一步
            </Button>
          )}
        </div>
      </div>
    );
}

竖直方向的步骤条

简单的竖直方向的步骤条。

import React from 'react';
import { Steps, Row, Col, Icon } from 'uiw';

export default function Demo() {
  return (
    <Row gutter={20}>
      <Col>
        <Steps current={1} direction="vertical" style={{ padding: '20px 0' }}>
          <Steps.Step title="已完成" description="这里是该步骤的描述信息" />
          <Steps.Step title="进行中" description="这里是该步骤的描述信息" />
          <Steps.Step status="error" title="待进行" description="这里是该步骤的描述信息" />
          <Steps.Step title="待进行" description="这里是该步骤的描述信息" />
        </Steps>
      </Col>
      <Col>
        <Steps direction="vertical" progressDot status="error" current={2} style={{ padding: '20px 0' }}>
          <Steps.Step title="步骤一" description="这里是步骤一的说明,可以很长很长哦。" />
          <Steps.Step title="步骤二" description="这里是步骤一的说明,可以很长很长哦。" />
          <Steps.Step title="步骤三" description="这里是步骤一的说明,可以很长很长哦。" />
          <Steps.Step icon={<Icon type="user"/>} title="步骤四" description="这里是步骤一的说明,可以很长很长哦。" />
        </Steps>
      </Col>
    </Row>
  )
}

Props

Steps

参数说明类型默认值
current指定当前步骤,从 0 开始记数。Number0
status当前步骤的状态,可选值为waitprocessfinisherrorStringprocess
direction指定步骤条方向,支持水平verticalhorizontalhorizontal
progressDot点状步骤条horizontal

Steps.Step

参数说明类型默认值
status指定状态。当不配置该属性时,会使用 Steps 的 current 来自动指定状态。可选:wait process finish errorStringwait
title指定每个步骤标题String/ReactNode-
description步骤的详情描述,可选String/ReactNode-
icon步骤的图标,字符串类型从<Icon/>组件中找,可选String/ReactNode-
4.22.0

8 months ago

4.22.1

6 months ago

4.22.2

6 months ago

4.22.3

5 months ago

4.21.26

1 year ago

4.21.25

1 year ago

4.21.28

1 year ago

4.21.27

1 year ago

5.0.0-bate.2.1

1 year ago

5.0.0-bate.2.0

1 year ago

4.21.24

1 year ago

5.0.0-bate-19

1 year ago

4.21.22

1 year ago

4.21.21

1 year ago

4.21.23

1 year ago

5.0.0-bate-18

1 year ago

5.0.0-bate-14

1 year ago

5.0.0-bate-17

1 year ago

5.0.0-bate-10

1 year ago

5.0.0-bate-11

1 year ago

5.0.0-bate-12

1 year ago

5.0.0-bate-9

1 year ago

5.0.0-bate-7

1 year ago

5.0.0-bate-8

1 year ago

5.0.0-bate-6

1 year ago

4.21.20

1 year ago

4.21.19

2 years ago

4.21.18

2 years ago

4.21.15

2 years ago

4.21.17

2 years ago

4.21.16

2 years ago

5.0.0-bate-5

2 years ago

5.0.0-bate-3

2 years ago

5.0.0-bate-4

2 years ago

5.0.0-bate-1

2 years ago

5.0.0-bate-2

2 years ago

5.0.0-bate-0

2 years ago

4.21.13

2 years ago

4.21.14

2 years ago

4.21.11

2 years ago

4.21.12

2 years ago

4.21.10

2 years ago

4.21.1

2 years ago

4.21.2

2 years ago

4.21.3

2 years ago

4.21.4

2 years ago

4.21.0

2 years ago

4.20.0

2 years ago

4.21.9

2 years ago

4.21.5

2 years ago

4.21.6

2 years ago

4.21.7

2 years ago

4.21.8

2 years ago

4.18.1

2 years ago

4.18.0

2 years ago

4.17.0

2 years ago

4.16.0

2 years ago

4.16.1

2 years ago

4.16.2

2 years ago

4.19.0

2 years ago

4.15.1

2 years ago

4.14.1

2 years ago

4.14.2

2 years ago

4.14.0

2 years ago

4.13.7

2 years ago

4.13.8

2 years ago

4.13.9

2 years ago

4.13.11

2 years ago

4.13.12

2 years ago

4.13.10

2 years ago

4.15.0

2 years ago

4.10.5

2 years ago

4.10.6

2 years ago

4.10.7

2 years ago

4.9.9

2 years ago

4.10.1

2 years ago

4.10.2

2 years ago

4.10.3

2 years ago

4.10.4

2 years ago

4.10.0

2 years ago

4.13.6

2 years ago

4.13.2

2 years ago

4.13.3

2 years ago

4.13.4

2 years ago

4.13.5

2 years ago

4.13.0

2 years ago

4.13.1

2 years ago

4.12.0

2 years ago

4.12.1

2 years ago

4.12.2

2 years ago

4.11.4

2 years ago

4.11.5

2 years ago

4.11.6

2 years ago

4.9.11

2 years ago

4.9.10

2 years ago

4.11.0

2 years ago

4.11.1

2 years ago

4.11.2

2 years ago

4.11.3

2 years ago

4.9.7

3 years ago

4.9.6

3 years ago

4.9.4

3 years ago

4.9.3

3 years ago

4.9.2

3 years ago

4.9.1

3 years ago

4.9.0

3 years ago

4.8.9

3 years ago

4.8.8

3 years ago

4.7.16

3 years ago

4.8.5

3 years ago

4.8.4

3 years ago

4.8.7

3 years ago

4.8.6

3 years ago

4.8.1

3 years ago

4.8.0

3 years ago

4.8.3

3 years ago

4.8.2

3 years ago

4.7.13

3 years ago

4.7.14

3 years ago

4.7.15

3 years ago

4.7.12

3 years ago

4.7.10

3 years ago

4.7.11

3 years ago

4.7.9

3 years ago

4.7.8

3 years ago

4.7.7

3 years ago

4.7.6

3 years ago

4.7.5

3 years ago

4.7.4

3 years ago

4.7.3

3 years ago

4.7.2

3 years ago

4.7.0

3 years ago

4.6.19

3 years ago

4.6.15

3 years ago

4.6.16

3 years ago

4.6.17

3 years ago

4.6.18

3 years ago

4.6.14

4 years ago

4.6.13

4 years ago

4.6.11

4 years ago

4.6.12

4 years ago

4.6.10

4 years ago

4.6.9

4 years ago

4.6.8

4 years ago

4.6.7

4 years ago

4.6.6

4 years ago

4.6.3

4 years ago

4.6.4

4 years ago

4.6.2

4 years ago

4.6.1

4 years ago

4.6.0

4 years ago

4.5.0

4 years ago

4.4.1

4 years ago

4.4.0

4 years ago

4.3.1

4 years ago

4.2.3

4 years ago

4.2.5

4 years ago

4.3.0

4 years ago

4.2.14

4 years ago

4.2.1

4 years ago

4.2.0

4 years ago

4.1.2

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.0

4 years ago

4.0.0-alpha.7

4 years ago

4.0.0-alpha.8

4 years ago

4.0.0-alpha.6

4 years ago

4.0.0-alpha.3

4 years ago

4.0.0-alpha.2

4 years ago

4.0.0-alpha.1

4 years ago

4.0.0-alpha.0

4 years ago