---
title: FileButton
description: "`FileButton` is a button component used for users to select files."
links:
- style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/file-button/file-button.style.ts
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/file-button
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-filebutton--basic
---
```tsx
Upload}
/>
```
## Usage
```tsx
import { FileButton } from "@yamada-ui/react"
```
```tsx
import { FileButton } from "@/components/ui"
```
```tsx
import { FileButton } from "@workspaces/ui"
```
```tsx
```
### Change Variant
```tsx
{(variant, index) => (
{toTitleCase(variant)}
)}
```
### Change Size
```tsx
{(size, index) => (
{toTitleCase(size)}
)}
```
### Change Color Scheme
```tsx
{(colorScheme, index) => (
{toTitleCase(colorScheme)}
)}
```
### Allow Multiple Selection
To allow multiple selection, set `multiple` to `true`.
```tsx
Upload
```
### Specify File Extensions
To specify file extensions, set `accept` to a string(type).
```tsx
Upload
```
### Disable
To disable, set `disabled` to `true`.
```tsx
Upload
Upload
```
### Read-Only
To make it read-only, set `readOnly` to `true`.
```tsx
Upload
Upload
```
### Invalid
To make the input invalid, set `invalid` to `true`.
```tsx
Upload
Upload
```
To change the border color, set `errorBorderColor` to a color.
```tsx
Upload
```
### Reset
To reset the value, set `resetRef` to `ref`. A callback function will be attached to the set `ref`, execute it.
```tsx
const [files, onChange] = useState(undefined)
const resetRef = useRef<() => void>(null)
const onReset = () => {
onChange(undefined)
resetRef.current?.()
}
return (
files: {files?.length ?? 0}
Upload
)
```
## Props
| Prop | Default | Type | Description |
| ------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | - | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"solid"` | `"ghost" \| "outline" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. |
| `active` | `false` | `boolean` | If `true`, the button is represented as active. |
| `defaultValue` | - | `File[]` | The initial value of the file input. |
| `disabled` | `false` | `boolean` | If `true`, the button is disabled. |
| `disableRipple` | `false` | `boolean` | If `true`, disable ripple effects when pressing a element. |
| `endIcon` | - | `string \| number \| bigint \| boolean \| ReactElement> \| Iterable \| ReactPortal \| Promise<...>` | The icon to display at the end side of the button. |
| `errorBorderColor` | - | `"-moz-initial" \| "ActiveBorder" \| "ActiveCaption" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" \| "amber.400" \| "amber.50" \| "amber.500" ...` | The border color when the input is invalid. |
| `fullRounded` | `false` | `boolean` | If `true`, the button is full rounded. Else, it'll be slightly round. |
| `iconProps` | - | `ButtonIconProps` | The props of the icon element. |
| `invalid` | `false` | `boolean` | If `true`, the field will be invalid. |
| `loading` | `false` | `boolean` | If `true`, the loading state of the button is represented. |
| `loadingIcon` | `"oval"` | `string \| number \| bigint \| boolean \| ReactElement> \| Iterable \| ReactPortal \| Promise<...>` | The icon to display when the button is loading. |
| `loadingMessage` | - | `string \| number \| bigint \| boolean \| ReactElement> \| Iterable \| ReactPortal \| Promise<...>` | The message to display when the button is loading. |
| `loadingPlacement` | `"start"` | `"end" \| "start"` | The placement of the loading indicator. Accepts `start` or `end`. |
| `loadingProps` | - | `ButtonLoadingProps` | The props of the loading icon element. |
| `onChange` | - | `(files: File[] \| undefined) => void` | Function to be called when a file change event occurs. |
| `readOnly` | `false` | `boolean` | If `true`, the field will be readonly. |
| `required` | `false` | `boolean` | If `true`, the field will be required. |
| `resetRef` | - | `RefObject<(() => void) \| null>` | Ref to a reset function. |
| `startIcon` | - | `string \| number \| bigint \| boolean \| ReactElement> \| Iterable \| ReactPortal \| Promise<...>` | The icon to display at the start side of the button. |
| `type` | `"button"` | `"button" \| "reset" \| "submit"` | The type of button. Accepts `button`, `reset`, or `submit`. |
| `value` | - | `File[]` | The value of the file input. |
## Accessibility
Currently, this section is being updated due to the migration of v2.