FileUpload
Click-or-drop zone with a visible label, custom title, hint, sizes and error; pair with FileItem rows.
Code
import * as React from 'react';
import { FileUpload } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
gap: 16,
maxWidth: 440,
}}
>
<FileUpload label="Attachments" hint="PNG, JPG or PDF up to 10 MB" multiple />
<FileUpload
label="Logo"
size="sm"
required
title={
<span>
<b>Upload logo</b>
{' · SVG or PNG'}
</span>
}
error="Add a logo to continue."
/>
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { FileUpload } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/file-upload.jsonGuidelines
labelis the visible field label (and names the zone for screen readers);titlereplaces the 'Choose a file or drag it here' text;ariaLabelonly when there's no visible label.- State accepted types and size in
hint.size="sm"is a one-line zone for dense forms.
Props
| Prop | Type | Required |
|---|---|---|
onFiles | (files: File[]) => void | No |
accept | string | No |
multiple | boolean | No |
label | React.ReactNode | No |
title | React.ReactNode | No |
hint | string | No |
error | React.ReactNode | No |
required | boolean | No |
size | 'sm' | 'md' | No |
disabled | boolean | No |
ariaLabel | string | No |
className | string | No |
style | React.CSSProperties | No |