FileButton

FileButton is a button component used for users to select files.

Usage

import { FileButton } from "@yamada-ui/react"
<FileButton />

Change Variant

Change Size

Change Color Scheme

Allow Multiple Selection

To allow multiple selection, set multiple to true.

Specify File Extensions

To specify file extensions, set accept to a string(type).

Disable

To disable, set disabled to true.

Please select a file to upload.

Read-Only

To make it read-only, set readOnly to true.

Please select a file to upload.

Invalid

To make the input invalid, set invalid to true.

Please select a file to upload.

To change the border color, set errorBorderColor to a color.

Reset

To reset the value, set resetRef to ref. A callback function will be attached to the set ref, execute it.

files: 0

Props

Accessibility

The FileButton follows the WAI-ARIA - Button Pattern for accessibility.

If you use only an icon for FileButton, set aria-label to FileButton.

<FileButton
  as={IconButton}
  aria-label="Upload file"
  icon={<PlusIcon fontSize="2xl" />}
/>

Keyboard Navigation

KeyDescriptionState
Enter, SpaceActivates the focused button and opens the file dialog.-

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
FileButtonaria-labelledbyIf FileButton is within a Field.Root and Field.Root has a label, sets its id.
aria-disabledSets to "true" if disabled or readOnly is set.