<download-button>
A download link with an icon. The label is the slot. With no file there is no link: a download button that points nowhere is not shown.
Building blocks
Examples
Default
Open on its own
Source
<download-button @url="/resources/starter.zip">Download the starter files</download-button>
Copy {name} to clipboard
Copy
Copied
Copy failed
html code
Long label
Open on its own
Source
<download-button @url="#">Download the complete course packet, with every slide deck, worksheet and starter file</download-button>
Copy {name} to clipboard
Copy
Copied
Copy failed
html code
Called with page data
Open on its own
Source
<download-button @url="/resources/starter.zip">Download the starter files</download-button>
Copy {name} to clipboard
Copy
Copied
Copy failed
html code
Props
Write them with the @ prefix, and :@ for an expression. A prop in square brackets is optional.
| Name |
Type |
Description |
url |
string |
the file to download. Only a string counts: a prop that is not given can resolve to Eleventy's url filter, which would print as the function's source |
Color tokens
The tokens this component's styles read. Set one in _data/theme.json to change it everywhere.
Pick a color to try it in every example above.