Live demo
Demo source
Overview
Use a file tile to show one file: in a list of attachments, after a file was
chosen, or while it uploads. It is the row that
file upload uses, and it works on its own
for existing documents. The tile uploads nothing: your application sets its
state and progress and reacts to its events.
Anatomy
The file upload anatomy shows completed, uploading and rejected file tiles together in the upload composition.
Parts
- Type icon: chosen from
fileTypeor the extension infileName. - Name and size: the size in bytes is formatted for the user's language, such as "1.2 MB".
- Status: a progress bar while
uploading, an indeterminate bar whileprocessing, a check whencomplete, and an errormessagewhenerrororinvalid.queued, the default, shows no status. - Action: cancel while uploading, no action while processing, and remove
in other editable states. An
errortile also offers "Try again". The tile only emitscancelClicked,removeClickedorretryClicked; your application changes the list.
States and themes
The six state values below describe upload progress. disabled and
readonly add the two remaining design states: disabled actions stay
visible but inert; read-only tiles have no actions. Both md and sm sizes
support Spark and Ocean in light and dark mode.
Accessibility
The file name labels the tile group, and its message is connected with
aria-describedby. Cancel, remove and retry buttons include the file name
in their accessible labels. Keep useful status text alongside colour and
progress so the result can be understood without relying on appearance.
Content and usage
- Name the reason in
message, such as "File too large — max 10 MB". - Use
readonlyfor files that can no longer change, anddisabledto keep actions visible but unusable. size="sm"suits dense layouts.
An invalid file needs a message naming the constraint and only a remove
action. Reserve Retry for error states that another upload attempt could
resolve. locale controls built-in text and file sizes in English, French,
Dutch and German, with English fallback.
Related
Use File upload for validation and list management, and Progress bar for the progress visualization.