跳到正文
Linasan UI

TableAction 操作列

表格行的操作按钮:超出数量收进「…」,带权限、确认、异步和禁用提示。

超出 3 个收进「…」
异步、禁用提示、确认
只显示图标
  • 最多 max(默认 3)个,含「…」;超出时保留前面的,其余收进下拉,danger 排最后。
  • onClick 返回 Promise 时按钮转圈直到完成。
  • auth 写权限码,判断方法由外层 TableActionProvider 统一提供。
  • placeholder 不显示但占位,让上下行的按钮对齐。

安装

pnpm dlx shadcn@latest add https://docs.linasan.cn/r/table-action.json

第一次装本站的组件前先在项目里执行一次 shadcn init,详见 安装。

用法

import { TableAction } from '@/components/data-table/table-action';

<TableAction
  actions={[{ label: '编辑', icon: <Pencil />, onClick: edit }]}
  dropdownActions={[{ label: '删除', icon: <Trash2 />, danger: true, popConfirm: { title: '确定删除?' }, onClick: remove }]}
/>

属性

属性

类型

本页目录