Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion fern/products/docs/pages/changelog/2026-03-12.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
---
tags: ["navigation", "configuration", "docs.yml"]
tags: ["components", "navigation", "configuration", "docs.yml"]
---

## Multi-file ZIP downloads

The `<Download>` component now supports bundling multiple files into a single ZIP download using the new `sources` prop. This is useful when you want users to download a collection of related assets — such as brand logos, SDK files, or configuration templates — without needing to host a pre-built ZIP file.

Pass an array of publicly accessible URLs to `sources`, and the component fetches each file client-side and packages them into a ZIP archive:

```jsx Markdown
<Download
sources={[
"https://example.com/assets/logo-dark.svg",
"https://example.com/assets/logo-light.svg",
"https://example.com/assets/icon.svg"
]}
filename="brand-assets.zip"
>
<Button intent="primary">Download brand assets</Button>
</Download>
```

<Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/writing-content/components/download">Read the docs</Button>

## `open-by-default` option for collapsed sections

Sections and folders in your sidebar navigation support a new `collapsed: open-by-default` value. Sections configured with this value start expanded but display a toggle so users can collapse them.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
---
title: Download
description: The Download component enables users to download PDFs and files from your documentation. Simple setup with custom filenames.
description: The Download component enables users to download PDFs, files, and multi-file ZIP bundles from your documentation.
---

<Markdown src="/snippets/agent-directive.mdx"/>

The `<Download>` component lets users download assets like PDFs directly from your documentation.
The `<Download>` component lets users download assets like PDFs directly from your documentation. You can use it for single files or bundle multiple files into a ZIP download.

<Info>
For information on how to embed images, PDFs, and other assets, check out the documentation on [Rich media in Markdown](/learn/docs/writing-content/markdown-media).
</Info>

## Usage

### Single file

<div className="highlight-frame">
<Download src="./all-about-ferns.pdf">
<Button intent="primary">Download PDF</Button>
</Download>
<div className="highlight-frame-content">
<Download src="./all-about-ferns.pdf">
<Button intent="primary">Download PDF</Button>
</Download>
</div>
</div>

```jsx Markdown
Expand All @@ -25,16 +29,39 @@ For information on how to embed images, PDFs, and other assets, check out the do
</Download>
```

### Multiple files as ZIP

Use the `sources` prop to bundle multiple files into a single ZIP download. The component fetches each file client-side and packages them into a ZIP archive using [fflate](https://github.com/101arrowz/fflate).

This is useful when you want users to download a collection of related assets — such as brand logos, SDK files, or configuration templates — without needing to host a pre-built ZIP file.

```jsx Markdown
<Download
sources={[
"https://example.com/assets/logo-dark.svg",
"https://example.com/assets/logo-light.svg",
"https://example.com/assets/icon.svg"
]}
filename="brand-assets.zip"
>
<Button intent="primary">Download brand assets</Button>
</Download>
```

## Properties

<ParamField path="src" type="string" required={true}>
Path to your local asset (relative to current MDX file). The asset must be located within the `fern` folder.
<ParamField path="src" type="string">
Path to a single file for download (relative to the current MDX file). The asset must be located within the `fern` folder. Use `src` for **single-file downloads**. Mutually exclusive with `sources` — you must provide one or the other.
</ParamField>

<ParamField path="sources" type="string[]">
An array of publicly accessible URLs to bundle into a ZIP download. Use `sources` for **multi-file downloads** — the component fetches each URL client-side and packages them into a ZIP archive. Mutually exclusive with `src`. If only one URL is provided, it behaves like `src` (downloads the file directly without zipping). The filename for each file inside the ZIP is derived from the last segment of its URL (e.g., `logo-dark.svg`). If any file fails to fetch, the entire download will fail.
</ParamField>

<ParamField path="children" type="React.ReactNode" required={true}>
The text or element to display as the click target for the download.
The text or element to display as the click target for the download. Typically a `<Button>` or styled link.
</ParamField>

<ParamField path="filename" type="string">
The filename to use for the downloaded asset. If not provided, the filename will be the same as the asset's name.
The filename for the downloaded file. When used with `sources`, this sets the name of the ZIP file (defaults to `download.zip`). When used with `src`, it overrides the original asset filename.
</ParamField>
Loading