The file
element is a simple interactive label that wraps an
<input type="file">
. It comprises several sub-elements:
-
file
the main container
-
file-label
the actual interactive and clickable part of the element
file-input
the native file input, hidden for styling purposes
-
file-cta
the upload call-to-action
file-icon
an optional upload icon
file-label
the "Choose a fileā¦" text
file-name
a container for the chosen file name
HTML
Modifiers
#
With the has-name
modifier combined with the file-name
element, you can add a
placeholder for the selected file name.
You can move the CTA to the right side with the is-right
modifier.
You can also expand the name to fill up the space with the is-fullwidth
modifier.
You can have a boxed block with the is-boxed
modifier.
You can combine has-name
and is-boxed
.
Colors
#
You can style the file element by appending one of the
0 color modifiers:
HTML
HTML
HTML
HTML
Sizes
#
You can append one of the 4 available sizes:
-
is-small
is-normal
(default)
-
is-medium
-
is-large
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
HTML
Alignment
#
You can align the file input:
- to the center with the
is-centered
modifier
- to the right with the
is-right
modifier
HTML
HTML
JavaScript
#
A file upload input requires JavaScript to retrieve the selected file name. Here
is an example of how this could be done:
HTML
Sass and CSS variables
#
Sass Variable
|
CSS Variable
|
Value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|