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:

  • 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
<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
#2
#3
#4
#5
#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-white
  • is-black
  • is-light
  • is-dark
  • is-primary
  • is-link
  • is-info
  • is-success
  • is-warning
  • is-danger

Sizes

You can append one of 3 additional sizes:

  • is-small
  • is-medium
  • is-large

Alignment

You can align the file input:

  • to the center with the is-centered modifier
  • to the right with the is-right modifier

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-colorcolor$border
$file-radiussize$radius
$file-cta-background-colorcolor$white-ter
$file-cta-colorcolor$grey-dark
$file-cta-hover-colorcolor$grey-darker
$file-cta-active-colorcolor$grey-darker
$file-name-border-colorcolorborder
$file-name-border-stylestringsolid
$file-name-border-widthsize1px 1px 1px 0
$file-name-max-widthsize16em