ListActions

Default action toolbar rendered on top of <List> views.

Installation

pnpm dlx shadcn@latest add @shadmin/list-actions

Usage

Pass <ListActions> to a <List> to render the conventional <FilterButton> + <CreateButton> + <ExportButton> combo on the right side of the header:

import { List, ListActions, DataTable } from "@/components/admin";
 
export const PostList = () => (
  <List actions={<ListActions />}>
    <DataTable>
      <DataTable.Col source="title" />
    </DataTable>
  </List>
);

You can override the actions by passing custom children:

import {
  CreateButton,
  ExportButton,
  List,
  ListActions,
} from "@/components/admin";
 
export const PostList = () => (
  <List
    actions={
      <ListActions>
        <CreateButton />
        <ExportButton />
      </ListActions>
    }
  >
    {/* ... */}
  </List>
);

Props

PropRequiredTypeDefaultDescription
childrenOptionalReactNodeFilter + Create + ExportReplace the toolbar content
resourceOptionalstringFrom contextOverride the resource name
filtersOptionalReactElement | ReactNode[]From FilterContextFilter inputs used to render the <FilterButton>
exporterOptionalExporter | booleanFrom ListContextDisable the export button by passing false
hasCreateOptionalbooleanFrom resource definitionForce showing/hiding the create button
classNameOptionalstringExtra Tailwind classes appended to the root element

children

Pass children to fully replace the toolbar content. This is the recommended escape hatch to add custom action buttons:

import { CreateButton, ExportButton, ListActions } from "@/components/admin";
 
const PostListActions = () => (
  <ListActions>
    <MyCustomButton />
    <CreateButton />
    <ExportButton />
  </ListActions>
);

exporter

Set exporter={false} to hide the export button entirely:

<ListActions exporter={false} />