File Upload
Upload one or more files
The file element is a simple interactive label that wraps an <input type="file">. It comprises several sub-elements:
filethe main containerfile-labelthe actual interactive and clickable part of the elementfile-inputthe native file input, hidden for styling purposesfile-ctathe upload call-to-actionfile-iconan optional upload iconfile-labelthe "Choose a file…" text
file-namea container for the chosen file name
<div class="file">
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
</label>
</div>
Modifiers
#1: With the has-name modifier combined with the file-name element, you can add a placeholder for the selected file name.
#2: You can move the CTA to the right side with the is-right modifier.
#3: You can also expand the name to fill up the space with the is-fullwidth modifier.
#4: You can have a boxed block with the is-boxed modifier.
#5: You can combine has-name and is-boxed.
#1
<div class="file has-name">
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
<span class="file-name">
Screen Shot 2017-07-29 at 15.54.25.png
</span>
</label>
</div>
#2
<div class="file has-name is-right">
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
<span class="file-name">
Screen Shot 2017-07-29 at 15.54.25.png
</span>
</label>
</div>
#3
<div class="file has-name is-fullwidth">
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
<span class="file-name">
Screen Shot 2017-07-29 at 15.54.25.png
</span>
</label>
</div>
#4
<div class="file is-boxed">
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
</label>
</div>
#5
<div class="file has-name is-boxed">
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
<span class="file-name">
Screen Shot 2017-07-29 at 15.54.25.png
</span>
</label>
</div>
Colors
You can style the file element by appending one of the 10 color modifiers:
is-whiteis-blackis-lightis-darkis-primaryis-linkis-infois-successis-warningis-danger
Sizes
You can append one of 3 additional sizes:
is-smallis-mediumis-large
Alignment
You can align the file input:
-
to the center with the
is-centeredmodifier -
to the right with the
is-rightmodifier
Variables #
You can use these variables to customize, Simply set one or multiple of these variables before importing Buval. Learn how.
Name | Type | Default |
|---|---|---|
$file-border-color | color | $border |
$file-radius | size | $radius |
$file-cta-background-color | color | $white-ter |
$file-cta-color | color | $grey-dark |
$file-cta-hover-color | color | $grey-darker |
$file-cta-active-color | color | $grey-darker |
$file-name-border-color | color | border |
$file-name-border-style | string | solid |
$file-name-border-width | size | 1px 1px 1px 0 |
$file-name-max-width | size | 16em |