File download
About this component
The file download component presents a file that the user can download.
The component features:
- the title of the file
- information about the file such as its file format and size
- a download link
- a thumbnail image
You can click on either the thumbnail image or the download link to download the file.
Why we use this component
The file download component provides a consistent way of presenting files for download. It provides useful information about the file such as the size and type of the file. This information can help users to decide whether to download it.
Other versions of this component
Generic thumbnail image
The Design System includes a collection of icons for common file types. Use these if you do not have a specific cover image for your file.
These icons are in the Design System’s npm module as well as the GitHub repository. You should copy these into your own project.
Highlighted file
You can highlight a file download block can to give it a more prominent appearance. This is useful in cases where there are many file download blocks and you want to give priority to one of them.
You should place any highlighted blocks at the beginning of a group of file download blocks. Highlighted blocks are most effective when they are the only one in a group.
Related components
- page metadata component
Website analytics
To understand user behaviour, you can track clicks on links in file download blocks through the click URL, the click text and a data attribute showing the interaction.
To help identify clicks on the thumbnail or file icon, there is a span with hidden text in that link.
The Design System’s ‘tracking’ script adds the data attributes.
Accessibility
Only the link in the file's title is available to screen readers. Screen readers skip the link on the thumbnail image. This avoids the repetition of having more than one link to the same item read out.
The download link uses ARIA attributes to give more context to the link. The link has an aria-describedby
attribute using the file's supporting metadata.
This ARIA attribute requires a unique ID attribute to be set on the metadata element.
Example screen reader output
Voiceover announces the download link in a file download block like this when it has focus: 'Link. Scotland’s Artificial Intelligence Strategy - Trustworthy, Ethical and Inclusive. File type: 44 page PDF, file size: 7.2 megabytes.'
Feedback, help and support
If you need help or support you can e-mail us at designsystem@gov.scot
There is a problem
Thanks for your feedback