ant-design/components/tabs/demo/basic.md
二货爱吃白萝卜 628968f460
feat: Tabs support items (#36889)
* refactor: Using items

* docs: replace with items

* docs: deprecated demo

* test: Update snapshot

* docs: simple basic demo

* test: coverage
2022-08-05 10:49:08 +08:00

701 B

order title
0
zh-CN en-US
基本 Basic

zh-CN

默认选中第一项。

en-US

Default activate first tab.

import { Tabs } from 'antd';
import React from 'react';

const onChange = (key: string) => {
  console.log(key);
};

const App: React.FC = () => (
  <Tabs
    defaultActiveKey="1"
    onChange={onChange}
    items={[
      {
        label: `Tab 1`,
        key: '1',
        children: `Content of Tab Pane 1`,
      },
      {
        label: `Tab 2`,
        key: '2',
        children: `Content of Tab Pane 2`,
      },
      {
        label: `Tab 3`,
        key: '3',
        children: `Content of Tab Pane 3`,
      },
    ]}
  />
);

export default App;