---
order: 14
group:
  title: 文本
  order: 40
---

## 切换 Tab

可改变背景、文字样式、标题名称

```tsx
import React from 'react';
import * as Charts from 'edata-charts';

const props = {
  id: 1,
  data: ['家人守护', '入园异常', '服务人员'],
  isLoop: true,
  timeGap: 2000,
  titleStyle: {
    fontFamily: 'Microsoft Yahei',
    fontWeight: 'normal',
    fontSize: 14,
    color: '#fff',
    background: 'rgba(0, 0, 0, 0.5)',
    width: 100,
  },
  size: { width: '330px', height: 30 },
};

export default () => <Charts.Tabs {...props} />;
```

默认选中

```tsx
import React from 'react';
import * as Charts from 'edata-charts';

const props = {
  data: ['家人守护', '入园异常', '服务人员'],
  isLoop: false,
  timeGap: 2000,
  titleStyle: {
    fontFamily: 'Microsoft Yahei',
    fontWeight: 'normal',
    fontSize: 14,
    color: '#fff',
    background: 'rgba(0, 0, 0, 0.5)',
    width: 100,
  },
  size: { width: '330px', height: 30 },
  activeIndex: 2,
};

export default () => <Charts.CommonTabs {...props} />;
```

## API

| 参数       | 说明       | 类型   |
| ---------- | ---------- | ------ |
| size       | 容器的宽高 | object |
| title      | 标题名称   | string |
| total      | 总数       | number |
| unit       | 单位       | string |
| titleStyle | 标题样式   | object |
| totalStyle | 总数样式   | object |
| unitStyle  | 单位样式   | object |

### size

| 参数   | 说明 | 类型           |
| ------ | ---- | -------------- |
| width  | 宽度 | number\|string |
| height | 高度 | number\|string |

### titleStyle

| 参数       | 说明     | 类型   |
| ---------- | -------- | ------ |
| fontSize   | 字体大小 | number |
| fontFamily | 字体     | string |
| color      | 字体颜色 | string |
| fontWeight | 字体粗细 | string |
| background | 背景色   | string |

### totalStyle

| 参数       | 说明     | 类型   |
| ---------- | -------- | ------ |
| fontSize   | 字体大小 | number |
| fontFamily | 字体     | string |
| color      | 字体颜色 | string |
| fontWeight | 字体粗细 | string |

### unitStyle

| 参数       | 说明     | 类型   |
| ---------- | -------- | ------ |
| fontSize   | 字体大小 | number |
| fontFamily | 字体     | string |
| color      | 字体颜色 | string |
| fontWeight | 字体粗细 | string |
