Steps 步骤条

显示一个任务的进度;或者引导用户完成某个复杂任务。

规则

  • 应用在离散和时间较长的进度显示,eg:转账进度;如果任务是连续和短暂的,应该使用 Progress 来显示,eg:打开页面。

  • 当任务复杂或者存在先后关系时,将其分解成一系列步骤,从而简化任务,eg:用户注册新账号。

代码演示

步骤条

  1. /* eslint global-require: 0 */
  2. import { Steps, WingBlank, WhiteSpace, Icon } from 'antd-mobile';
  3. const Step = Steps.Step;
  4. ReactDOM.render(
  5. <WingBlank size="lg">
  6. <div className="sub-title">Small size</div>
  7. <WhiteSpace />
  8. <Steps size="small" current={1}>
  9. <Step title="Finished" description="This is description" />
  10. <Step title="In Progress" description="This is description" />
  11. <Step title="Waiting" description="This is description" />
  12. </Steps>
  13. <div className="sub-title">Small size, single line text</div>
  14. <WhiteSpace />
  15. <Steps size="small" current={1}>
  16. <Step title="Finished" />
  17. <Step title="In Progress" />
  18. <Step title="Waiting" />
  19. </Steps>
  20. <div className="sub-title">Default size</div>
  21. <WhiteSpace size="lg" />
  22. <Steps>
  23. <Step status="process" title="Finished" description="This is description" />
  24. <Step status="error" title="Error" description="This is description" />
  25. <Step title="Waiting" description="This is description" />
  26. </Steps>
  27. <div className="sub-title">Customized status </div>
  28. <WhiteSpace size="lg" />
  29. <Steps>
  30. <Step status="finish" title="Step 1" icon={<Icon type={require('./pay-circle.svg')} />} />
  31. <Step status="process" title="Step 2" icon={<Icon type={require('./pay-circle.svg')} />} />
  32. <Step status="error" title="Step 3" icon={<Icon type={require('./pay-circle.svg')} />} />
  33. </Steps>
  34. <div className="sub-title">Customized icon </div>
  35. <WhiteSpace size="lg" />
  36. <Steps current={1}>
  37. <Step title="Step 1" icon={<Icon type={require('./pay-circle.svg')} />} description="This is description" />
  38. <Step title="Step 2" icon={<Icon type={require('./pay-circle.svg')} />} description="This is description" />
  39. <Step title="Step 3" icon={<Icon type={require('./pay-circle.svg')} />} description="This is description" />
  40. </Steps>
  41. <div className="sub-title">Multiple steps </div>
  42. <WhiteSpace size="lg" />
  43. <Steps current={1}>
  44. <Step title="Step 1" icon={<Icon type={require('./pay-circle.svg')} />} />
  45. <Step title="Step 2" icon={<Icon type={require('./pay-circle.svg')} />} />
  46. <Step title="Step 3" status="error" icon={<Icon type={require('./pay-circle.svg')} />} />
  47. <Step title="Step 4" icon={<Icon type={require('./pay-circle.svg')} />} />
  48. </Steps>
  49. </WingBlank>
  50. , mountNode);
  1. .sub-title {
  2. color: #888;
  3. font-size: .28rem;
  4. padding: 30px 0 18px 0;
  5. }

水平方向的步骤条

  1. /* eslint global-require: 0 */
  2. import { Steps, WingBlank, WhiteSpace, Icon } from 'antd-mobile';
  3. const Step = Steps.Step;
  4. const steps = [{
  5. title: 'Finished',
  6. description: 'This is description',
  7. }, {
  8. title: 'In Progress',
  9. description: 'This is description',
  10. }, {
  11. title: 'Waiting',
  12. description: 'This is description',
  13. }].map((s, i) => <Step key={i} title={s.title} description={s.description} />);
  14. ReactDOM.render(
  15. <WingBlank mode={20} className="stepsExample">
  16. <div className="sub-title">Horizontal small size</div>
  17. <WhiteSpace />
  18. <Steps current={1} direction="horizontal" size="small">{steps}</Steps>
  19. <div className="sub-title">Horizontal default size</div>
  20. <WhiteSpace />
  21. <Steps current={1} direction="horizontal">{steps}</Steps>
  22. <div className="sub-title">Horizontal customized icon</div>
  23. <WhiteSpace />
  24. <Steps direction="horizontal">
  25. <Step title="Step 1" icon={<Icon type={require('./pay-circle.svg')} />} />
  26. <Step status="error" title="Step 2" icon={<Icon type={require('./pay-circle.svg')} />} />
  27. <Step title="Step 3" icon={<Icon type={require('./pay-circle.svg')} />} />
  28. </Steps>
  29. <div className="sub-title">Horizontal timeline mode</div>
  30. <WhiteSpace />
  31. <Steps current={-1} direction="horizontal" size="small" className="timeline">
  32. <Step title="Now" description="Buy" icon={<span className="fake-icon" />} />
  33. <Step title="Nov. 3rd" description="Buy success" icon={<span className="fake-icon" />} />
  34. <Step title="Nov. 4th" description="Profit arrival" icon={<span className="fake-icon" />} />
  35. </Steps>
  36. </WingBlank>
  37. , mountNode);
  1. .stepsExample .timeline.am-steps.am-steps-small
  2. .am-steps-item.am-steps-custom
  3. .am-steps-head-inner > .am-steps-icon {
  4. width: 0.16rem;
  5. height: 0.16rem;
  6. border-radius: 50%;
  7. background-color: #d9dff1;
  8. }
  9. .stepsExample .timeline.am-steps.am-steps-small .am-steps-tail {
  10. top: 0.06rem;
  11. padding: 0 0.16rem;
  12. background-color: transparent;
  13. }
  14. .sub-title {
  15. color: #888;
  16. font-size: .28rem;
  17. padding: 30px 0 18px 0;
  18. }

Steps步骤条 - 图1

API

  1. <Steps>
  2. <Step title="第一步" />
  3. <Step title="第二步" />
  4. <Step title="第三步" />
  5. </Steps>

Steps

适用平台:WEB、React-Native 整体步骤条。
参数说明类型默认值
current指定当前步骤,从 0 开始记数。在子 Step 元素中,可以通过 status 属性覆盖状态number0
size尺寸,支持设置小尺寸smallstring-
directionstep 样式( RN 目前只支持 vertical )Enum { 'vertical', 'horizontal' }vertical

Steps.Step

步骤条内的每一个步骤。
参数说明类型默认值
status指定状态。当不配置该属性时,会使用 Steps 的 current 来自动指定状态。Enum { 'wait', 'process', 'finish', 'error' }wait
title标题React.Element-
description步骤的详情描述,可选React.Element-
icon步骤图标,可选object/React.Element-