Skip to main content
Version: 3.xx.xxSwizzle 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:

http://localhost:3000/posts
Live previews only work with the latest documentation.
import { useExport } from "@pankod/refine-core";
import {
useDataGrid,
DataGrid,
GridColumns,
List,
ExportButton,
} from "@pankod/refine-mui";

const columns: GridColumns = [
{ field: "id", headerName: "ID", type: "number" },
{ field: "title", headerName: "Title", minWidth: 400, flex: 1 },
];

const PostsList: React.FC = () => {
const { dataGridProps } = useDataGrid<IPost>();

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

return (
<List
headerButtons={(
<ExportButton
onClick={triggerExport}
loading={exportLoading}
/>
)}
>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
</List>
);
};

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

Properties

hideText

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

http://localhost:3000
Live previews only work with the latest documentation.
import { ExportButton } from "@pankod/refine-mui";

const MyExportComponent = () => {
return (
<ExportButton
hideText={true}
/>
);
};

API Reference

Properties

External Props

It also accepts all props of Material UI LoadingButton.