Free Download Form

Form that hands out a family's free fonts for a name and an email

Displays a form that gives customers a family’s free fonts for their name, email address and agreement to the license. Submitting it creates and completes an order of its own – separate from the cart – and emails the receipt with the download link; the form then tells the customer to check their inbox.

<fontdue-free-download-form
collection-slug="rubik"
></fontdue-free-download-form>
import FreeDownloadForm from "fontdue-js/FreeDownloadForm";
<FreeDownloadForm collectionSlug="rubik" />

The form renders lazily as shown. On a server-rendered framework you can preload it with loadFreeDownloadFormQuery, passing the same collection, and hand the result over as preloadedQuery – see lazy versus preloaded:

import FreeDownloadForm, { loadFreeDownloadFormQuery } from "fontdue-js/FreeDownloadForm";
const freeDownload = await loadFreeDownloadFormQuery({ collectionSlug: "rubik" });
<FreeDownloadForm preloadedQuery={freeDownload} />

What the form shows

The form names the collection by collection-slug or collection-id. When the whole family is free it asks only for the customer’s details; when only some styles are, it lists them first in a p.free-download__styles (“Free styles: Regular, Italic”).

The agreement checkbox links each license the fonts come with; agreement-label replaces its text. The newsletter checkbox uses your newsletter opt-in label, and appears even without one when your store requires the newsletter – marked “(required to download)”, with the button disabled until it’s ticked. Whatever the checkbox said when the customer ticked it is recorded with their signup.

If nothing in the collection is free – or the slug is wrong, or the collection is hidden – the form is replaced by the message “These fonts aren’t available as a free download.” in a div.free-download--unavailable. After a successful submission the form becomes a div.free-download--sent holding the check-your-email message.

Sites that install fontdue-js from npm need version 3.16.0 or later for the form. The <script> tag has it already.

Properties

Property Description Type
collection-slug The family whose free fonts the form hands out, by slug string
collection-id The same, by ID string
agreement-label Replaces the license agreement checkbox’s text (HTML allowed) string
download-label Text for the button. Defaults to “Download” string
newsletter-checkbox-checked Include this attribute to tick the newsletter checkbox by default boolean
Prop Description Type
collectionSlug The family whose free fonts the form hands out, by slug string
collectionId The same, by ID string
agreementLabel Replaces the license agreement checkbox’s text (HTML allowed) string
downloadLabel Text for the button. Defaults to “Download” string
newsletterCheckboxChecked Tick the newsletter checkbox by default boolean
preloadedQuery Server-preloaded data from loadFreeDownloadFormQuery. Optional – the form fetches lazily without it. object