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.
| Prop | Type | Default | Description |
|---|---|---|---|
| after | ReactNode | — | |
| align | "center" | "left" | "right" | — | |
| appearance | "accent" | "negative" | "positive" | "neutral" | "overlay" | — | |
| before | ReactNode | — | |
| children | ReactNode | Choose file | Button text. |
| className | string | — | |
| rounded | boolean | — | |
| size | "s" | "m" | "l" | — | |
| slotProps | { root?: (LabelHTMLAttributes<HTMLLabelElement> & { ref?: Ref<HTMLLabelElement>; }); } | undefined | — | Props for the visible `<label>` button. `className` and `style` also go there. |
| stretched | boolean | — | |
| variant | "link" | "primary" | "secondary" | "tertiary" | "outline" | — |