Duolith docs

FileInput

A button that asks for files or photos, and the list of those chosen, each with a remove button.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe button's text, such as Add photos.
files{ name: string; size?: number }[]bindable([])What was chosen, by name and size in bytes. Bind it with bind:files={name}.
iconstringuploadThe button's icon.
onPick() => voidRuns when the button is pressed: ask for files there, with the media-picker effect, and add what comes back to files.

States

StateLooks like
emptyA dashed button.
chosenEach chosen file under the button, with its size and a remove button.

Accessibility

rolenone; a button, then a button per file
nameThe label prop names the button; each remove button says which file it removes.
focusTab reaches the button, then each remove button.
keyboardEnter and Space press them.

Theme tokens

color.border color.surface color.raised color.primary color.ink color.muted radius.full space.2 space.3 text.label text.body text.caption

Example

<FileInput label="Add photos" bind:files={photos} onPick={pick} />