Johann-S / bs-custom-file-input

A little plugin for Bootstrap 4 custom file input
https://bs-custom-file-input.netlify.com/
MIT License
210 stars 39 forks source link
angular bootstrap bootstrap4 custom-input react typescript vanilla-javascript vanilla-js vanillajs

bs-custom-file-input

npm version dependencies Status devDependencies Status Build Status Coverage Status JS gzip size BrowserStack Status

A little plugin which makes Bootstrap 4 custom file input dynamic with no dependencies.

You can use it on React and Angular too because this plugin is written with the most used JavaScript framework: VanillaJS.

Demo

Features:

Table of contents

Install

With npm

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

CDN

CDN Link
jsDelivr https://cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.js
jsDelivr, minified https://cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.min.js

How to use it

You should wait for the document ready event and call the init method to make your custom file input dynamic. We expose one global variable available everywhere: bsCustomFileInput

$(document).ready(function () {
  bsCustomFileInput.init()
})

Use it with npm

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

For more examples check out this file.

This library is UMD ready so you can use it everywhere.

Methods

init

Finds your Bootstrap custom file input and will make them dynamic.

Parameters

destroy

Removes this plugin from your Bootstrap custom file input and restore them at their first initial state

Compatibility

bsCustomFileInput is compatible with:

You can find our BrowserStack list of browsers here.

Support me

If you want to thank me, you can support me and become my Patron

Thanks

BrowserStack Logo

Thanks to BrowserStack for providing the infrastructure that allows us to test in real browsers!

License

MIT