@linkdesign/screen
Version:
屏组件库,但使用场景又不局限于屏。主要用于BI、大盘和屏
103 lines (74 loc) • 2.92 kB
Markdown
# 筛选按钮 FilterButton
## 使用场景
分组单选、tab切换等
## 预览

## 演示
<!--before-content-->
## 基础用法
```js
import { Text } from '@linkdesign/screen';
const { FilterButton } = Text;
class App extends React.Component {
render() {
return (
<div data-theme="dark" style={{backgroundColor: "#1f3b6d", height: 500}}>
<FilterButton
className="filter-wrapper-row"
dataSource={['全部', '选项一', '选项二']}
defaultActiveKey="全部"
/>
<FilterButton
className="filter-wrapper-column"
direction="column"
align="right"
defaultActiveKey="all"
dataSource={[{
label: '全部',
value: 'all',
}, {
label: '选项一',
value: 'option1',
}, {
label: <span>选项二</span>,
value: 'option2',
}]}
/>
</div>
);
}
}
ReactDOM.render(<App />);
```
<!--after-content-->
### API
| 参数名 | 说明 | 必填 | 类型 | 默认值 | 备注 |
| ------------------------- | ------------ | ---- | ---------------------------------------------------- | ------ | ---- |
| defaultActiveKey | 位置坐标 | N | String \| Number | - | |
| onChange | 切换选择回调 | N | Function<br />(activeKey: string \| number) => void; | - | |
| [dataSource](#dataSource) | 数据源 | Y | Array | - | |
| className | 类名 | N | String | - | |
| [textStyle](#textStyle) | 文本样式 | N | Object | ```{ fontWeight: 400, fontFamily: 'PingFang SC, Microsoft YaHei, serif'}``` | |
| align | 对齐方式 | N | Enum<br />'left' \| 'middle' \| 'right' | ```'middle'``` | 水平排列方式 |
| direction | 文字排列方式 | N | Enum<br />'row' \| 'column' | ```'row'``` | 垂直排列方式 |
#### dataSource
```typescript
type Data = {
name: React.ReactNode;
key?: string;
} | string;
// 数据源
dataSource: Data[];
```
#### textStyle
```typescript
// 文本样式
textStyle?: {
fontFamily?: string;
fontSize?: string | number;
color?: string;
fontWeight?: string | number;
};
```
## TODO List
- [ ] ......