Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Download Trigger

Used to trigger a download of a file.

SourceStorybookArk

Usage

import { DownloadTrigger } from "@chakra-ui/react"
<DownloadTrigger data="..." fileName="x.png" mimeType="image/png" />

Examples

Basic

Pass the data you want to download to the data prop, and specify the fileName and mimeType of the file.

Download SVG

Here's an example of how to download an SVG file.

Promise

You can also trigger downloads from a promise that returns a Blob, File, or string.

File Size

Compose the DownloadTrigger with the FormatByte component to display the size of the file in a human-readable format.

Props

Previous

ClientOnly

Next

EnvironmentProvider