Custom File Input For Bootstrap 4 - bs-custom-file-input

Custom File Input For Bootstrap 4 - bs-custom-file-input

Yet another JavaScript plugin to extend the Bootstrap 4 from controls that help you create custom file selection input with browser button for file upload.

Also supports multiple file selections.

1. Install the bs-custom-file-input with NPM.

npm install bs-custom-file-input --save

2. Import the bs-custom-file-input as a module.

import bsCustomFileInput from 'bs-custom-file-input'

3. Or directly import the bs-custom-file-input plugin into your Bootstrap 4 page.

<link rel="stylesheet" href="" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="dist/bs-custom-file-input.js"></script>

4. Initialize the plugin on document ready.

$(document).ready(function () {

5. Create a custom file input following the html structure like this.

<div class="custom-file">
  <input type="file" class="custom-file-input">
  <label class="custom-file-label" for="inputGroupFile01">Choose file</label>
<div class="custom-file">
  <input type="file" multiple class="custom-file-input">
  <label class="custom-file-label" for="inputGroupFile01">Choose several files</label>

This awesome jQuery plugin is developed by Johann-S. For more Advanced Usages, please check the demo page or visit the official website.

  • Publication date: 22.08.2018
  • Source