Forms

File input

File inputs enable users to choose files from their device, allowing them to upload documents, images, or other types of files.

Basic example

Default

Basic file input example.

Label

Basic file input example with label.

Size

File input sizes

Add responsive class `input-{size}` where `{size} = xs|sm|md|lg|xl` for file input of different sizes.

Types

Default

Default type.

Floating label

Floating label example.

Validation states

Success state

Success state can be show using `is-valid` class.

Helper text
Helper text

Error state

Error state can be show using `is-invalid` class.

Helper text
Helper text

Illustrations

File input with button

The `file:` prefix in Tailwind allows us to style the `::file-selector-button`, and it can be combined with the `btn` class.

Disabled

Add the `disabled` boolean attribute on an file input to remove pointer events, and prevent focusing.

Helper text and label

Placement of helper text and label.

Helper text

Multiple files

Add `multiple` attribute to select more then 1 file.

Avatar

The following example showcases a file input with an avatar.

Avatar
Class referenceThe component, style, color, state, size and modifier classes available for this component.
ClassTypeDescription
inputcomponentBase class for form input.
input-floatingcomponentBase class for floating form input.
label-textpartBase class for title label text.
input-floating-labelpartFloats the label to the top.
helper-textpartBase class for helper label text.
is-validstateAdds success style to the input.
is-invalidstateAdds error style to the input.
file:{tw-utility-class}modifierAdds tailwind classes to update file input.
input-xssizeInput with Extra small size.
input-smsizeInput with Smaller size.
input-mdsizeInput with medium(default) size.
input-lgsizeInput with Larger size.
input-xlsizeInput with Extra large size.