<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

File Tile

A representation of a file such as an uploaded image or a template asset.
styleKey: fileTile

Use File Tile...

  • To display user-initiated file uploads.
  • To show the upload progress and status of a file.

Don't use File Tile...

Default

The File Tile component is designed to display individual files.

The preview has been updated.

Skin

Use the skin prop to specify the state of the File Tile. The default is standard. Use queued for files that are waiting to be loaded. Use loading for files that are currently being loaded.

The preview has been updated.

Error

To show an error on a File Tile, set skin="error" and set an errorMessage. Ensure that a File Tile with an error is always wrapped in a FormField in order to access the form context.

The preview has been updated.

List

The default UI layout is layout="thumb" which displays the File Tile as a 1:1 square. Use layout="list" for a more condensed list view that stacks vertically.

The preview has been updated.

Thumbnail

If the file is an image, pass a ResponsiveImage as a child to the FileThumbnail. File Tile handles the aspect ratio of the image.

The preview has been updated.

Description

Use fileDescription to show the file size. e.g. 3.56 MB. It can also be used to show other metadata such as file dimensions. e.g. 600px x 400px.

The preview has been updated.

Deleting files

The FileTileDeleteButton subcomponent allows users to control the files they upload. This subcomponent is optional but recommended in most use cases.

File Upload pattern

File Tile is part of a larger pattern of uploading files. The File Upload pattern ensures users are presented with a consistent UI regardless of the file types uploaded or the specific page navigated to.

For more information, see File Upload.

The preview has been updated.

Errors

If File Tile has skin="error" or an errorMessage, then it needs to be wrapped in a FormField component so that the form context exists. Pairing this with a File Dropzone will automatically pick up the errors from File Tile and apply them to the file input in the File Dropzone.

Props

FileTile
See core props for additional props that can be applied to this component.
proptyperequireddefaultdeprecation notes
fileName
The name of the file
string
true
null
⚠️ Deprecated
accessibleTextForProgress
@deprecated This prop will be removed in favor of SWAN's i18n system. Please opt in to the i18n system for continued support. The localized accessible text for the Progress component
string
false
null
This prop will be removed in favor of SWAN's i18n system. Please opt in to the i18n system for continued support.
⚠️ Deprecated
accessibleTextForSpinner
@deprecated This prop will be removed in favor of SWAN's i18n system. Please opt in to the i18n system for continued support. The localized accessible text for the Spinner component
string
false
null
This prop will be removed in favor of SWAN's i18n system. Please opt in to the i18n system for continued support.
fileDescription
The description of the file, could be file size or dimensions e.g. "3.56 MB" or "600x400"
stringnull
false
null
layout
The visual layout of the FileTile
"list""thumb"null
false
thumb
skin
The visual style of the FileTile
"standard""loading""error""queued"null
false
standard
progressValue
The percentage of progress of the file upload
numbernull
false
null
errorMessage
Error message on file upload failure
stringnull
false
null
FileTileDeleteButton
See core props for additional props that can be applied to this component.
proptyperequireddefaultdeprecation notes
⚠️ Deprecated
accessibleText
@deprecated This prop will be removed in favor of SWAN's i18n system. Please opt in to the i18n system for continued support. The localized accessible text used for screen readers
string
false
null
This prop will be removed in favor of SWAN's i18n system. Please opt in to the i18n system for continued support.

Internationalization

SWAN's Internationalization System allows SWAN components to render with fully translated and accessible text out-of-the-box. The following keys are provided to allow you to override the default translation.

Default TextKey
File upload is {{progress}} complete
file-tile.accessible-text-for-progress
Waiting to upload
file-tile.accessible-text-for-spinner
Delete file
file-tile-delete-button.accessible-text-for-icon