datui
Color scheme

Forms

File

Button that opens the native file picker.

import { File } from "datui";

Playground

<File variant="primary" size="m">Choose file</File>

Examples

Variants

No files selected

Accessibility

  • The real <input type="file"> stays focusable (visually hidden); the button text is its label and shows the focus ring.
  • Enter/Space on the input open the picker natively; onChange(event) is the input's.

API

File

Button that opens the native file picker: a `<label>` styled as Button around a visually hidden `<input type="file">`. The input keeps focus and Enter/Space; `ref` and `onChange(event)` are the input's.

PropTypeDefaultDescription
afterReactNode—
align"center" | "left" | "right"—
appearance"accent" | "negative" | "positive" | "neutral" | "overlay"—
beforeReactNode—
childrenReactNodeChoose fileButton text.
classNamestring—
roundedboolean—
size"s" | "m" | "l"—
slotProps{ root?: (LabelHTMLAttributes<HTMLLabelElement> & { ref?: Ref<HTMLLabelElement>; }); } | undefined—Props for the visible `<label>` button. `className` and `style` also go there.
stretchedboolean—
variant"link" | "primary" | "secondary" | "tertiary" | "outline"—