FileButton
moleculesA real file input hidden inside a label styled as a Button: keyboard focusable, opens the native picker with no JS and emits the chosen files.
Import a CSV
accept, variant="primary", onfiles receiving the picked File[]; the same input can be picked twice in a row.
CSV exports from your exchange, up to 50 MB.
Variants, sizes and icon-only
variant default, primary, ghost; size sm, md, lg; control matches input height; iconOnly and box shrink it to a glyph with the label kept for assistive tech.
States
disabled, multiple with accept filtering, hitArea="compact" in a dense row, and a long label (buttons never wrap) truncating in a narrow box.
PNG or JPEG only; other types are filtered by the picker.
compact hit area for a dense toolbar
Props
| Prop | Type | Default | Description |
|---|---|---|---|
onfiles required | (files: File[]) => void | โ | |
label | string | 'Choose file' | |
icon | IconName | โ | A registered glyph name (rendered as SVG). Use `emoji` for an off-registry glyph. |
emoji | string | '๐' | Off-registry glyph such as an emoji, rendered as text as-is. Defaults to the ๐ paperclip emoji; ignored when `icon` is set. |
iconOnly | boolean | false | Hide the label visually, showing only the icon. The label is kept for assistive tech (and used as the accessible name). |
accept | string | โ | |
multiple | boolean | false | |
disabled | boolean | false | |
variant | 'default' | 'primary' | 'ghost' | 'default' | |
size | ControlSize | โ | Match the Button atom's sizes so a FileButton lines up with buttons in the same row. |
control | boolean | false | Uniform control height, like Button's `control`, so it lines up in a composer/toolbar row; follows a sized `Cluster`. |
box | 'xs' | 'sm' | 'md' | 'lg' | โ | Shared square box scale (`--box-xs/sm/md/lg`); implies `iconOnly`. |
hitArea | 'auto' | 'compact' | 'auto' | Icon-only buttons grow a touch hit slab on coarse pointers; `compact` opts out. |
sound | boolean | true | Play UI sounds when enabled globally; false silences this instance. |
class | string | '' |