Skip to main content
Swizzle Ready

Export

<ExportButton> is a Material UI <LoadingButton> with a default export icon and a default text with "Export". It only has presentational value.

Refer to the for more detailed information about useExport.

Swizzle

You can swizzle this component to customize it with the refine CLI

Usage

Use it like any other Ant Design <Button>. You can use it with useExport:

/src/pages/posts/list.tsx
import { useExport, useTable } from "@pankod/refine-core";
import {
ExportButton,
List,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
} from "@pankod/refine-mui";

export const PostList: React.FC = () => {
const { tableQueryResult } = useTable<IPost>();

const { triggerExport, isLoading: exportLoading } = useExport<IPost>();

return (
<List
cardHeaderProps={{
action: (
<ExportButton
onClick={triggerExport}
loading={exportLoading}
/>
),
}}
>
<Table>
<TableHead>
<TableRow>
<TableCell>ID</TableCell>
<TableCell>Title</TableCell>
</TableRow>
</TableHead>
<TableBody>
{tableQueryResult.data?.data.map((row) => (
<TableRow key={row.title}>
<TableCell>{row.id}</TableCell>
<TableCell component="th" scope="row">
{row.title}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</List>
);
};

interface IPost {
id: number;
title: string;
}

It looks like this:

Default export button

Properties

hideText

It is used to show and not show the text of the button. When true, only the button icon is visible.

import { ExportButton } from "@pankod/refine-mui";

export const MyRefreshComponent = () => {
return <ExportButton hideText />;
};

API Reference

Properties

External Props

It also accepts all props of Material UI LoadingButton.