/
kaws
/
ui-kit-ce
Обзор
Документация
Войти
/
kaws
/
ui-kit-ce
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/table/examples/TableLayoutStory.tsx
41 строка
981 B
Denis Svyatovets
v1.10.0
27 мар 2024, 13:48
27 мар 2024, 13:48
c9029ae
Код
Авторство
О чём код?
import * as React from 'react' import { Table, ColumnProps, RecordDataSource, RowProps } from '@v-uik/base' type DataSource = RecordDataSource<{ name: string; role: string }> export const TableLayoutStory = (): JSX.Element => { const dataSource: DataSource[] = [ { name: 'Vasya', role: 'developer', key: 1 }, { name: 'Slava', role: 'developer', key: 2 }, { name: 'Anton', role: 'manager', key: 3 }, { name: 'Artem', role: 'designer', key: 4 }, { name: 'Fillip', role: 'designer', key: 5 }, ] const columns: ColumnProps<DataSource>[] = [ { key: 'name', dataIndex: 'name', title: 'Name', width: 300, }, { key: 'role', dataIndex: 'role', title: 'Role', }, ] return ( <Table dataSource={dataSource} columns={columns} tableLayout="fixed" setRowProps={(params) => { return { 'data-name': params.row.name, } as RowProps }} /> ) }