You are viewing a PR preview for PR #1506

Agriculture Design System
Beta
Design System for the Export Service

File input

The File input component allows users to attach one file to a form field by browsing their device.

View in FigmaView in StorybookView in Github
import { ... } from '@ag.ds-next/react/file-input';

Usage

File input components can be imported via the file-input entrypoint in the @ag.ds-next/react package.

For example:

import { ... } from '@ag.ds-next/react/file-input';

Props

FileInput Props
PropTypeDescription
labelstringDescribes the purpose of the field.
accept?string
autoFocus?boolean
capture?boolean | "user" | "environment"
disabled?boolean
hideOptionalLabel?booleanIf true, "(optional)" will never be appended to the label.
hint?stringProvides extra information about the field.
id?string
invalid?booleanIf true, the invalid state will be rendered.
message?stringMessage to show when the field is invalid.
multiple?boolean
name?string
onBlur?FocusEventHandler<HTMLInputElement>
onChange?ChangeEventHandler<HTMLInputElement>
onFocus?FocusEventHandler<HTMLInputElement>
ref?Ref<HTMLInputElement>
required?booleanIf false, "(optional)" will be appended to the label.
value?string | number | readonly string[]

Source

You can view the full source code for this package on Github.