File Upload
File Upload is a component that enables users to upload single or multiple files with validation, progress tracking, and customization options.
| Type | Resource |
|---|---|
| Design | Figma |
| Mobile | Web Storybook |
| Code | Gitlab |
Overview

Usage
import id.co.biofarma.binduiandroid.components.single_file_upload.FileUploadFileUpload(
selectedFiles = remember { mutableStateOf(listOf()) },
onUploadChange = { files ->
// Handle file changes
},
label = "Upload Document"
)Examples
Single vs Multiple Upload
Choose between single file or multiple file upload modes.

Size Variations
The component supports different sizes to match your design needs.

Progress Tracking
Show upload progress with a built-in progress bar.

States
The component supports various states including error and disabled.

Props
| Props | Required | Default | Type | Description |
|---|---|---|---|---|
| id | false | "" | String | Unique identifier for the component |
| selectedFiles | true | mutableStateOf(listOf()) | MutableState<List<File>> | Currently selected files |
| onUploadChange | true | - | (List<File>) -> Unit | Callback when files are selected |
| disabled | false | false | Boolean | Disables the upload functionality |
| style | false | Modifier | Modifier | Custom styles for the component |
| size | false | "sm" | String | Component size: “sm”, “md”, “lg” |
| allowedFileTypes | false | ["jpg", "png", "pdf"] | List<String> | Allowed file extensions |
| maxFileSizeInMB | false | 5 | Byte | Maximum allowed file size |
| showProgress | false | false | MutableState<Boolean> | Controls progress bar visibility |
| currentProgress | false | 0 | MutableIntState | Upload progress percentage |
| remainingTimeInSec | false | 0 | MutableIntState | Remaining upload time |
| helperText | false | "" | String | Helper text below component |
| label | false | "" | String | Label above component |
| isError | false | false | MutableState<Boolean> | Error state flag |
| errorText | false | "" | MutableState<String> | Error message text |
| isMultiple | false | false | Boolean | Enable multiple file selection |
| onDelete | false | {} | (File) -> Unit | Callback when file is deleted |
Guidelines
- File Types: Use
allowedFileTypesto restrict uploads to specific formats. - Size Limits: Set appropriate
maxFileSizeInMBbased on your requirements. - Progress: For large files, enable
showProgressto provide upload feedback. - Error Handling: Use
isErroranderrorTextfor validation feedback. - Labels: Provide clear
labelandhelperTextfor better user guidance.