ant-design/components/steps/demo/clickable.md
黑雨 65f067eb13
feat: Steps supports items (#37531)
* feat: support items

* feat: update demo

* test: update package

* test: update use type

* test: update for test

* test: update for lint

* feat: update doc

* test: update for lint

* test: update for lint

* test: update for lint

* test: add deprecated dome

* test: add deprecated dome

* doc: update doc

* feat: update package

* test: add test case
2022-09-16 15:52:14 +08:00

1.3 KiB
Raw Blame History

order title
10
zh-CN en-US
可点击 Clickable

zh-CN

设置 onChangeSteps 变为可点击状态。

en-US

Setting onChange makes Steps clickable.

import { Divider, Steps } from 'antd';
import React, { useState } from 'react';

const App: React.FC = () => {
  const [current, setCurrent] = useState(0);

  const onChange = (value: number) => {
    console.log('onChange:', current);
    setCurrent(value);
  };
  const description = 'This is a description.';

  return (
    <>
      <Steps
        current={current}
        onChange={onChange}
        items={[
          {
            title: 'Step 1',
            description,
          },
          {
            title: 'Step 2',
            description,
          },
          {
            title: 'Step 3',
            description,
          },
        ]}
      />

      <Divider />

      <Steps
        current={current}
        onChange={onChange}
        direction="vertical"
        items={[
          {
            title: 'Step 1',
            description,
          },
          {
            title: 'Step 2',
            description,
          },
          {
            title: 'Step 3',
            description,
          },
        ]}
      />
    </>
  );
};

export default App;