npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

advisor-select2-bootstrap-5-theme

v1.1.1

Published

Select2 v4 theme for Bootstrap 5

Downloads

33

Readme

Select2 Bootstrap 5 Theme

GitHub npm Packagist Version License Dependencies

Select2 v4 theme for Bootstrap 5, inspired by select2-bootstrap4-theme

Works with Select2 v4.0 and v4.1

Examples

https://apalfrey.github.io/select2-bootstrap-5-theme/

Installation

CDN

Select2 v4.0

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.full.min.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/select2-bootstrap-5-theme.min.css" />
<!-- Or for RTL support -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/select2-bootstrap-5-theme.rtl.min.css" />

Select2 v4.1

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/select2-bootstrap-5-theme.min.css" />
<!-- Or for RTL support -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/select2-bootstrap-5-theme.rtl.min.css" />

Package Managers

# npm
$ npm install select2-bootstrap-5-theme

# yarn
$ yarn add select2-bootstrap-5-theme

# composer
$ composer require apalfrey/select2-bootstrap-5-theme

HTML

<link rel="stylesheet" href="/path/to/select2.css">
<link rel="stylesheet" href="/path/to/select2-bootstrap-5-theme.min.css">
<!-- Or for RTL support -->
<link rel="stylesheet" href="/path/to/select2-bootstrap-5-theme.rtl.min.css">

SCSS

@import "node_modules/select2/src/scss/core";
@import "node_modules/select2-bootstrap-5-theme/src/include-all";

Usage

// Basic
$("select").select2({
    theme: "bootstrap-5",
});

// Small using Select2 properties
$("#form-select-sm").select2({
    theme: "bootstrap-5",
    containerCssClass: "select2--small", // For Select2 v4.0
    selectionCssClass: "select2--small", // For Select2 v4.1
    dropdownCssClass: "select2--small",
});

// Small using Bootstrap 5 classes
$("#form-select-sm").select2({
    theme: "bootstrap-5",
    dropdownParent: $("#form-select-sm").parent(), // Required for dropdown styling
});

// Large using Select2 properties
$("select").select2({
    theme: "bootstrap-5",
    containerCssClass: "select2--large", // For Select2 v4.0
    selectionCssClass: "select2--large", // For Select2 v4.1
    dropdownCssClass: "select2--large",
});

// Large using Bootstrap 5 classes
$("#form-select-lg").select2({
    theme: "bootstrap-5",
    dropdownParent: $("#form-select-lg").parent(), // Required for dropdown styling
});

Building

This repo uses Gulp to compile the assets, see below for the included npm scripts and Gulp tasks and what they do;

| npm script | Gulp task | Description | | ------------------ | ------------------ | ---------------------------------------------------------------------------------------------------------------------- | | start | default | Cleans the dist directory, lints the scss, compiles the dev and min versions, starts browsersync and starts watching | | clean | clean | Cleans the dist directory, removing the directory and it's contents | | lint | lint | Lints the scss files using Stylelint, see .stylelintrc and stylelint-config-twbs-bootstrap for linting rules | | compile | compile | Lints the scss, compiles the RTL and LTR dev and min versions | | compile:main | compile:main | Compiles all LTR versions, saving in dist and docs | | compile:main:dev | compile:main:dev | Compiles the LTR expanded version, saving in dist and docs | | compile:main:min | compile:main:min | Compiles the LTR compressed version, saving in dist | | compile:rtl | compile:rtl | Compiles all RTL versions, saving in dist and docs | | compile:rtl:dev | compile:rtl:dev | Compiles the RTL expanded version, saving in dist and docs | | compile:rtl:min | compile:rtl:min | Compiles the RTL compressed version, saving in dist | | watch | watch | Watches all files in src, compiling the scss when changes are detected | | browsersync | browsersync | Sets up a browsersync server serving the docs directory for development |

Contributing

If you have ideas for improvements or changes, feel free to submit an issue, or if you have changes you'd like in the project, feel free to submit a pull request. Make sure you run gulp compile or npm run compile before submitting a pull request to ensure the styles are compiled.

License

MIT License

Copyright (c) 2020 Andrew Palfrey <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.