Data Grid - Export component
Let users export the Data Grid for Excel, CSV, or printing.
The
export feature
is enabled by default when
showToolbar is passed to the
<DataGrid /> component.
You can use the Export and Toolbar components when you need to customize the export menu, or when implementing a custom toolbar.
Basic usage
The demo below shows how to add export triggers to a custom toolbar.
Anatomy
import { ExportPrint, ExportCsv } from '@mui/x-data-grid';
import { ExportExcel } from '@mui/x-data-grid-premium';
<ExportPrint />
<ExportCsv />
<ExportExcel />
Export Print
<ExportPrint /> is a button
that triggers a print export. It renders the
baseButton slot.
Export CSV
<ExportCsv /> is a button
that triggers a CSV export. It renders the
baseButton slot.
Export Excel
<ExportExcel /> is a button
that triggers an Excel export. It renders the
baseButton slot.
Recipes
Below are some ways the Export components can be used.
Toolbar export menu
The demo below shows how to display export options within a menu on the toolbar.
Custom elements
Use the render prop to replace
default elements. See
Components usage—Customization
for more details, and
Toolbar—Custom elements demo
for an example of custom Export buttons.
Accessibility
ARIA
You must apply a text label or an
aria-label attribute to the
<ExportPrint />,
<ExportCsv /> and
<ExportExcel /> components.
API
See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.