Component Location:
design-system/components/AxFileItemOverview
AxFileItem displays an individual file in an upload list with automatic file-type icons, upload progress, status indicators (success/error), and action buttons (remove/retry). Designed to replace Ant Design’s default file list UI with a custom design.
Import
Basic Usage
Upload States
With Image Preview
Props
File name displayed as the primary label. Used to determine the file-type icon when
icon is not provided.File size in bytes. Automatically formatted to human-readable format (e.g., “2.4 MB”, “156 KB”).
Current upload status of the file.
"idle"— File selected, not yet uploading (default)"uploading"— Upload in progress, shows progress bar"success"— Upload complete, shows green checkmark"error"— Upload failed, shows red indicator and optional retry button
Upload progress percentage (0–100). Only rendered when
status="uploading".Values outside 0–100 are automatically clamped.Error message displayed below the file name when
status="error".Example: "File exceeds 10MB limit"Custom file-type icon. By default, the icon is inferred from the file extension in
name:.xlsx, .xls, .csv→FileExcelOutlined.pdf→FilePdfOutlined.doc, .docx→FileWordOutlined.jpg, .png, .gif, etc.→FileImageOutlined- All others →
FileOutlined
Image preview URL shown as a thumbnail in the icon box. Pass
URL.createObjectURL(file) or a data URL for image uploads.When set, replaces the file-type icon entirely.Callback fired when the user clicks the remove/cancel button. Always shown regardless of status.
Callback fired when the user clicks the retry button. Only shown when
status="error".Component size preset.
"sm"— Compact size for modals and drawers"md"— Standard size (default)
Disable interactions (remove, retry). Reduces opacity to indicate disabled state.
Additional CSS class name for the root element.
Inline styles applied to the root element.
Type Definitions
AxFileItemStatus
| Status | Description | Visual Indicator |
|---|---|---|
idle | File selected, not uploading | Default state, no indicator |
uploading | Upload in progress | Progress bar with percent |
success | Upload complete | Green checkmark (CheckCircleFilled) |
error | Upload failed | Red exclamation mark + error message |
AxFileItemSize
AxFileItemProps
Examples
Complete Upload Flow
File List
Image Gallery with Previews
Custom File Icon
Small Size in Modal
Disabled State
File Type Icons
The component automatically maps file extensions to appropriate icons:| Extension | Icon Component |
|---|---|
.xlsx, .xls, .csv | FileExcelOutlined |
.pdf | FilePdfOutlined |
.doc, .docx | FileWordOutlined |
.jpg, .jpeg, .png, .gif, .svg, .webp | FileImageOutlined |
| All others | FileOutlined |
File Size Formatting
File sizes are automatically formatted:< 1 KB: “X B” (bytes)< 1 MB: “X.X KB” (kilobytes)≥ 1 MB: “X.X MB” (megabytes)
Accessibility
- Root element uses
role="listitem"for semantic list structure - Dynamic
aria-labeldescribes file name and upload status - Progress bar uses
role="progressbar"witharia-valuenow,aria-valuemin,aria-valuemax - Error messages use
role="alert"for immediate screen reader announcement - Action buttons have descriptive
aria-labelattributes - Status icons include
aria-labelfor screen readers
Design Notes
- Icon box is 40px × 40px (md) or 32px × 32px (sm)
- Progress bar uses
transform: scaleX()for smooth animation - Image previews completely replace the file-type icon
- Error state shows both error icon and retry button (if
onRetryis provided) - File name and size are displayed inline with a middle-dot separator