LeKoala Dev Blog

LeKoala Dev Blog

Bootstrap 5 tags

Bootstrap 5 tags

I have been experimenting recently a lot with Bootstrap 5. Getting rid of jQuery was a long overdue task, but now, I don't have the choice anymore :-)

Reinventing the wheel

Well... if you need a kind of tagging system, you know probably Select2 . But... it requires jQuery.

So what about the alternatives ? A popular option is Choices but did you see the size of that thing ? Annnd... its maintainer is not so active anymore.

What if we could create something ourselves ?

Enter Bootstrap 5 tags

Actually, we have most of the things we already need in Bootstrap 5 : a dropdown menu, inputs, validation and badges... we just need to mix these together to create a nice little plugin.

Let's go straight to the demo:

This plugin has two modes:

  • One that only allows provided options and triggers a validation message if you try to type something else
  • One that allow you to create new tags on the fly

It's still a bit "proof of concept" but it's been working pretty well so far. Keep posted by following and/or staring the repo .

Pssst, there is more

I've also been working on making autogrowing textareas ... it's a simple task really, but finding a nice plugin to do so... not so easy. Here is the repo .

#bootstrap#web-development#javascript#js
 
Share this