Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

Components / Foundations

FileInputBase

The native <input type="file"> for Cynosure, and the only module allowed to render one. It is a foundation: no visual opinions, so composites style or hide it.

Who uses itLink to "Who uses it"

FileDrop.

When to use it directlyLink to "When to use it directly"

Only when building a new composite that picks files.

Use a component instead when you want people to add files: FileDrop gives a drop zone, a picker button, checks and messages.

Picking calls on files

UsageLink to "Usage"

tsx
Copy
import { FileInputBase, setInputFiles } from "@arshad-shah/cynosure";

<FileInputBase name="attachment" accept="image/*" multiple onFiles={(files) => …} />

// Files that arrived another way (a drop) can be put into the input, so forms submit them:
setInputFiles(input, droppedFiles);

PropsLink to "Props"

Every prop of FileInputBase
PropWhat it doesTypeDefault
onFiles
Called with the files picked (an empty array when the picker is cleared).((files: File[]) => void)

Generated from the type definitions in @arshad-shah/cynosure 0.5.0.

BehaviourLink to "Behaviour"

  • onFiles receives an array of Files; an empty array when the selection is cleared.
  • setInputFiles replaces the input's files, so FormData and form submission include them.
  • A disabled input picks nothing and is not submitted.

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog