This is documentation for Refine 4.xx.xx, which is no longer actively maintained.
<ExportButton>
is an Ant Design <Button>
with a default export icon and a "Export" text. It only has presentational value.
For more information, refer to the useExport
documentation →
Good to know:
You can swizzle this component to customize it with the Refine CLI
Usage
You can use it like any other Ant Design <Button>
.
For example, you can use it with useExport:
Live previews only work with the latest documentation.
import { useExport } from "@refinedev/core";
import {
List,
useTable,
ExportButton,
} from "@refinedev/antd";
import { Table } from "antd";
const PostList: React.FC = () => {
const { tableProps } = useTable<IPost>();
const { triggerExport, isLoading: exportLoading } = useExport<IPost>();
return (
<List
headerButtons={
<ExportButton onClick={triggerExport} loading={exportLoading} />
}
>
<Table {...tableProps} rowKey="id">
<Table.Column dataIndex="id" title="ID" />
<Table.Column dataIndex="title" title="Title" />
</Table>
</List>
);
};
interface IPost {
id: number;
title: string;
}
Properties
hideText
hideText
is used to hide the text of the button. When its true
, only the button icon will be visible.
Live previews only work with the latest documentation.
import { ExportButton } from "@refinedev/antd";
const MyExportComponent = () => {
return (
<ExportButton
hideText={true}
/>
);
};
API Reference
Properties
Property | Type | Description | Default |
---|
hideText | | Whether should hide the text and show only the icon or not. | |
onClick | (PointerEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLElement>)
| Sets the handler to handle click event | |
loading | ((boolean
{ delay?: number; icon?: ReactNode; }) & boolean)
| Set the loading status of button | |
External Props:
It also accepts all props of Ant Design Button.