# FileInput A standalone file picker with optional drag-and-drop, validation limits, and presentational drop-zone content. ## Usage Use standalone, or inside `FileField`. ```svelte Drop files ``` ## Anatomy The `class` attribute values represent part names, and `conditional` indicates elements that are rendered conditionally. Other attributes represent their corresponding props. ```svelte
{aux}
{aux}
``` Drag-over renders the local variant as `active`. `children` must be presentational; place interactive remove or clear controls in `aux`. `accept` is re-checked by the primitive because drag-and-drop bypasses the native picker filter. ## Props | Name | Type | Default | Description | |---|---|---|---| | `children*` | `Snippet` | - | Required presentational content for the drop zone; receives files, drag-over state, and variant | | `files` | `File[]` | - | Bindable selected files | | `multiple` | `boolean` | `false` | Allows selecting more than one file | | `accept` | `string` | - | Accepted file types for committed files | | `maxSize` | `number` | - | Maximum file size in bytes | | `maxFiles` | `number` | - | Maximum number of committed files | | `droppable` | `boolean` | `false` | Enables drag-and-drop on the drop zone | | `rejectBy` | `[]` | - | Bindable list of reject reasons from the most recent add attempt | | `flip` | `boolean` | `false` | Renders `aux` before the drop zone instead of after it | | `aux` | `Snippet` | - | External snippet for interactive controls such as remove buttons | | `events` | `FileInputEvents` | - | Functions that can filter which added or removed files are committed | | `attach` | `Attachment` | - | Svelte attachment on the input | | `element` | `HTMLInputElement` | - | Bindable input element | | `styling` | `SVSClass` | - | Styling override | | `variant` | `SVSVariant` | `NEUTRAL` | Variant | `*` required. Other `HTMLInputAttributes` are passed to `` via rest props; `class` is merged onto the control. Input attributes such as `disabled`, `required`, and `name` are passed at the top level. ## Styling To learn more, see [Styling](/docs/styling). ### Variant Management During drag-over, the local variant is forced to `active`. Otherwise there is no automatic switching. ### Default Class Name `svs-file-input` ## Accessibility ### ARIA Roles and Attributes The component applies these automatically: - Input (`main` ``): `aria-describedby`, `aria-invalid`, and `aria-errormessage` from the field-validation wiring and current error-message id. Provide an accessible name yourself because there is no built-in visible label. Pass `aria-label` or `aria-labelledby` through the rest props, or associate a `