File controls can be used to select files and attach them to forms.

import {FileField} from "@makigas/svelte";

<FileField label="Avatar" helper="Select a photo to use as profile picture." />
Select a photo to use as profile picture.

Disabled

Add the disabled prop to mark the field as disabled.

Select a photo to use as profile picture.

Icon

The FileField component supports an additional snippet called iconAfter, to put an icon at the end of the input. There is no point on adding an icon at the start due to the nature of this widget.

Validation

For validation purposes, you can add the validation prop with the value either as "valid" or "invalid".

File uploaded correctly.
Wait, why did you upload a WebP file?

Sizes

Use the size prop to alter the size of the file field.

Select a photo to use as profile picture.
Select a photo to use as profile picture.
Select a photo to use as profile picture.
Select a photo to use as profile picture.
Select a photo to use as profile picture.

© 2022-2025 makigas

Licensed under the terms of the GNU LGPL license.