ExportData
- Last Updated: May 5, 2026
- 2 minute read
- MarkLogic Server
- Documentation
The ExportData widget displays a button for downloading application content. When configuring the widget, the value to be exported can be data, a function that returns data, or a Promise that resolves to data.
By default, the widget offers three format options: comma-separated values (CSV), JSON, and XML. When you click the button, a dropdown menu appears allowing the user to select a format. After a format is selected, the value is exported. The widget can also be configured to export custom formats.
If the widget is configured to export only one type of format, no dropdown is displayed and the export occurs on button click.
Configuration with default formats
import { ExportData } from "ml-fasttrack";
// ...
<ExportData
data={context.searchResponse.results}
prefix={'Export:'}
label={'Select Format and Save'}
themeColor={'primary'}
/>
The above code displays the widget with the three default format options.
Rendered widget
![]() |
Configuration with custom export
import { ExportData } from "ml-fasttrack";
// ...
const customExport = (data) => {
return JSON.stringify({ envelope: data })
}
<ExportData
data={myData}
label={'Export Custom Data'}
formats=[{
text: 'Custom Format',
id: 'myFormat',
extension: '.json',
transform: customExport
}]
filename='custom-export'
appendTimestamp={false}
/>
The above code exports data as a custom JSON object. The exported content is saved with the filename "custom-export.json".
Rendered widget
API
Prop |
Type |
Description |
|---|---|---|
data |
any |
Content to export. Can be data, a function that returns data, or a Promise that resolves to data. |
formats[] |
object[] |
An array of format configuration objects. |
formats[].text |
string |
The text label for the dropdown menu. |
formats[].id |
string | number |
The ID for the format. |
formats[].extension |
string |
The filename extension for the exported file. |
formats[].transform |
function |
The function that transforms the data to the exported content. Receives the |
formatsShown |
string[] |
Array of IDs of formats to show in the menu in display order. This allows you to limit the default formats shown or reorder the formats. |
className |
string |
Class name applied to the widget. |
prefix |
string |
Prefix string to display to the left of the button. |
label |
string |
Label to apply to the button. |
themeColor |
string |
KendoReact theme color to apply to the button. See the KendoReact ButtonProps. |
filename |
string |
Text to use as the exported filename. |
appendTimestamp |
boolean |
Whether to append an underscore followed by a timestamp the exported filename. |
ButtonProps |
KendoReact Button props for the button displayed when one format is available. |
|
DropDownButtonProps |
KendoReact DropDownButton props for the dropdown button displayed when multiple formats are available. |
