gravity-ui / uikit

https://gravity-ui.com
MIT License
516 stars 84 forks source link

Table improvements: add icons for actions in withTableActions HOC #1622

Closed shbov closed 2 weeks ago

shbov commented 1 month ago

Is it possible to add icon?: Pick<IconProps, 'data' | 'size'> prop in the TableAction type and display them only if all actions are provided with icons? uikit already has an IconProps interface

It would be nice to have action with icon in the Table component for better UX

image
amje commented 3 weeks ago

@shbov It's already implemented:

import {Printer} from '@gravity-ui/icons';

<Table getRowActions={() => [{text: 'Print', icon: <Icon data={Printer} size={12} />}]}/>

I've imporved Table example here: https://github.com/gravity-ui/landing/pull/211

shbov commented 3 weeks ago

@shbov It's already implemented:

import {Printer} from '@gravity-ui/icons';

<Table getRowActions={() => [{text: 'Print', icon: <Icon data={Printer} size={12} />}]}/>

I've imporved Table example here: gravity-ui/landing#211

Thanks! We also need to add prop icons to TableAction as well here