Git Product home page Git Product logo

select2-bootstrap-theme's Introduction

Select2

Build Status Financial Contributors on Open Collective jsdelivr cdnjs

Select2 is a jQuery-based replacement for select boxes. It supports searching, remote data sets, and pagination of results.

To get started, check out examples and documentation at https://select2.org/

Use cases

  • Enhancing native selects with search.
  • Enhancing native selects with a better multi-select interface.
  • Loading data from JavaScript: easily load items via AJAX and have them searchable.
  • Nesting optgroups: native selects only support one level of nesting. Select2 does not have this restriction.
  • Tagging: ability to add new items on the fly.
  • Working with large, remote datasets: ability to partially load a dataset based on the search term.
  • Paging of large datasets: easy support for loading more pages when the results are scrolled to the end.
  • Templating: support for custom rendering of results and selections.

Browser compatibility

  • IE 8+
  • Chrome 8+
  • Firefox 10+
  • Safari 3+
  • Opera 10.6+

Usage

You can source Select2 directly from a CDN like jsDelivr or cdnjs, download it from this GitHub repo, or use one of the integrations below.

Integrations

Third party developers have created plugins for platforms which allow Select2 to be integrated more natively and quickly. For many platforms, additional plugins are not required because Select2 acts as a standard <select> box.

Plugins

Themes

Missing an integration? Modify this README and make a pull request back here to Select2 on GitHub.

Internationalization (i18n)

Select2 supports multiple languages by simply including the right language JS file (dist/js/i18n/it.js, dist/js/i18n/nl.js, etc.) after dist/js/select2.js.

Missing a language? Just copy src/js/select2/i18n/en.js, translate it, and make a pull request back to Select2 here on GitHub.

Documentation

The documentation for Select2 is available online at the documentation website and is located within the docs directory of this repository.

Community

You can find out about the different ways to get in touch with the Select2 community at the Select2 community page.

Copyright and license

The license is available within the repository in the LICENSE file.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

select2-bootstrap-theme's People

Contributors

anestik avatar codymullins avatar fk avatar kalidema avatar kevin-brown avatar nelson6e65 avatar odahcam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

select2-bootstrap-theme's Issues

Clear button appears but nothing happen when clicked

I have added this theme to my project but when I set allowClear option, the "x" appears but when I click on it, the dropdown is displayed but nothing happen.

When seeing the demo in Select2 4.0.2 page, the clear works, so I think the problem is in this theme.

Two problems that can be eliminated very easily

I saw two problems that can be eliminated very easily.

  1. Based on bower.json specification please see the highlighted text below:
    Only one file per filetype.
    Do not include minified files.

    "main": [
    "dist/select2-bootstrap.css",
    "dist/select2-bootstrap.min.css"
    ],
    So these two rules are ignored in this case, but the best solution would be declaration of scss file as entry-point in order to be consistent with Select2 core. This is very important when you use with nodejs something like main-bower-files or wiredep .
  2. Also it is very important to add !default flag to all variables under select2-bootstrap.scss file.

optgroup wrong font style

font-size is wrong, and maybe color also...simply remove it from select2-results__group style

.select2-container--bootstrap .select2-results__group {
    /*color: #777;*/
    display: block;
    padding: 6px 12px;
    /*font-size: 12px;*/
    line-height: 1.428571429;
    white-space: nowrap;
}

Dropdown width over-/underflow

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate
  • The issue still exists against the latest master branch of Select2 (not tested)
  • This is not a usage question (Those should be directed to the community)
  • I have attempted to find the simplest possible steos to reproduce the issue
  • I have included a failing test as a pull request (Optional)

Steps to reproduce the issue

  1. Create a horizontal boostrap form with a select input inside a div-tag with col-md-x option
  2. Open select input

Expected behavior and actual behavior

When I follow those steps, I see...
a 1-pixel width under-/overflow

I was expecting...
no under-/overflow

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Microsoft Edge

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: 2.2.0
  • Select2 version: 4.0.1
  • Bootstrap version: 3.3.6
  • Bootstrap-Theme version: master

Isolating the problem

  • This bug happens on the examples page (see col-md-3)
  • The bug happens consistently across all tested browsers
  • This bug happens when using Select2 without other pluigns
  • I can reproduce this bug in a jsbin

Example

overflow

No LESS love?

The less file is empty. Personally I like SASS more but sites like these accept .less only. And I need them cause my bootstrap variables are customized and are in less only. :(

Dropdown shadow overlaps container when positioned above

Hi everybody!

A pic is better than any words:
select2-bootstrap-dropdown-shadow

As you can see the dropdown shadow is shifted down 6px so overlaps the select2 element. Also, probably the shadow should be above the dropdown, not below. I don't know if this is intended behaviour.

I fixed it by simply duplicate line 24:

$dropdown-box-shadow-below: 0 6px 12px rgba(0,0,0,.175) !default;
$dropdown-box-shadow-above: 0 -6px 12px rgba(0,0,0,.175) !default;

and using the style accordingly.

Thanks!

Not for production?

Note: Work in progress โ€“ depending on your use case, select2-bootstrap-theme might not be production-ready yet!

Could you specify why in the documentation? And for which cases is it not ready?

Those are the things I would expect to see in the Compatibility section of the documentation before deciding to choose it or not.

.select2-bootstrap-prepend

screen shot 2015-04-15 at 09 59 29

screen shot 2015-04-15 at 10 22 53

I've eliminated all CSS/JS files on a one-by-one basis to check that there are no conflicts. However, it seems that I can't get select2-bootstrap-prepend to display the field correctly.

I'm using Bootstrap v3.3.4 and Select2 4.0.0-rc.2.

<div class="input-group select2-bootstrap-prepend">
<span class="input-group-addon"><i class="fa fa-fw fa-globe"></i></i></span>
<select id="join_country" name="join_country" class="form-control" value="" required="required">
<option></option>
<option>01</option>
<option>02</option>
</select>
</div>
<script>
$("#join_country").select2({
minimumResultsForSearch: -1,
placeholder: "Country",
allowClear: true
});
</script>

Add on in middle

Is it possible to have a input add on in the middle of two select2 drop downs? Or have a select2 drop down - input add on - input text field? Is there a class for this?

Ex: [dropdown][= sign][input field]

Input-lg doesn't work

Hi,

Nothing to do, my input is not "LG", nor "SM"...
When I load the page, my default select is displayed in LG then a few milliseconds later the plugins loads I guess and the input change its height to "Medium".

<select class="companies-select2 form-control input-lg select2-hidden-accessible" name="company_id" tabindex="-1" aria-hidden="true"><option value="1">Google</option><option value="2">Yahoo</option></select>

Am I missing something?

Dependencies error

Cloned repo, then executed the command: npm install

npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants grunt@>=1.0.1
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.1
npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.5
npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0

npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /tmp/select2/bower_components/select2-bootstrap-theme
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code EPEERINVALID
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/select2/bower_components/select2-bootstrap-theme/npm-debug.log
npm ERR! not ok code 0

It seems like peerDependecies are invalid.

Containment of select2 on a few examples

@fk I know i'm a little late to the game but just wanting to make sure this is an issue.

A few select2's in your demonstrations blows outside the form-group

  • Select2 multi append Radiobutton
  • Select2 multi append
  • Select2 multi prepend

Boostrap 3.37 correct height

In the https://github.com/select2/select2-bootstrap-theme/blob/master/dist/select2-bootstrap.css

I needed to change this

.select2-container--bootstrap .select2-selection--single {
  height: 34px;
  line-height: 1.42857143;
  padding: 6px 24px 6px 12px;
  /**
     * Adjust the single Select2's dropdown arrow button appearance.
     */
}

To

.select2-container--bootstrap .select2-selection--single {
  height: 44px;
  line-height: 1.42857143;
  padding: 10px 24px 6px 12px;
  /**
     * Adjust the single Select2's dropdown arrow button appearance.
     */
}

before

after

my html code:

<div class="input-group">
           <div class="form-group">
                   <select data-placeholder="Selecione um aluno" class="form-control " id="aluno" >
                               <option>1</option>
                               <option>2</option>
                    </select>
            </div>
            <div class="input-group-btn">
                    <button type="submit" name="save"  value="Salvar"  class="btn btn-success" ><i class="glyphicon glyphicon-plus"></i></button>
             </div>
</div>

Responsiveness

Hello,

I thought bootstrap is created to make websites responsive, but this plugin doesn't fix the responsiveness issues at all.
It does style it to a nice bootstrap looking button but without the responsiveness its useless.

Could this be implemented.

downarrow button in wrong place?

image

This may or may not be select2-bootstrap-theme's fault -- but I'm at a total loss for how to fix it. I turned on borders for the arrow button in the debugger, and the box is in the right place (mostly, it seems a little too far to the right), but the actual icon for the arrow button is to the left of the hitbox for the downarrow button)

Add $s2bs-input-border-width variable

I use a custom border-width on my buttons and form-controls of 3px using a custom variable which I called $input-border-width.

At the moment I override the select2-bootstrap-theme like so:

.select2-container--bootstrap {
	.select2-selection {
		border-width:$input-border-width;
	}

	.select2-search--dropdown {
		.select2-search__field {
			border-width:$input-border-width;
		}
	}

	.select2-dropdown {
		border-width:$input-border-width;
	}
}

It would be nice to have variable like $s2bs-input-border-width available in the first place, that spares me those additional lines.

That doesn't change anything for existing installs, yet enables users to customize the styles in a more consistent way.

Multiple input-sm height problem

Hi,
thank you for the great job.

I have a problem with the class "input-sm" combined with multiple choices: i can't obtain the right height.
You can see the problem here: https://codepen.io/policchio/pen/dOPLdp
If I try to delete "height: auto" in the class ".select2-selection--multiple" I obtain the right height, but obviously the wrong behaviour.

Thank you in advance!

Component doesen't resizes

I am not sure if I am doing something wrong or it is an issue. When I resize the browser window or inspect the page for mobile devices the component is not shrinking it stays the same size.
untitled

Select2 update with the CSS classes

You can now have Select2 copy over the container CSS classes using the old containerCssClass method. You can specify :all: to have Select2 copy over all classes on the container, similar to what it used to do.

This requires the full build, and it's only available on master at the moment. I have no idea when I'm going to be finalizing this release, but I hope it's soon.

.option.load-more results css

When using ajax and paging there is a 'load more results' message which shows in the dropdown. There needs to be css added for this to match the rest of the dropdown box. Something like :

.select2-container--bootstrap .option.load-more {
    padding:6px;
}

Compilation error with less-grails-asset-pipeline

With less-grails-asset-pipeline plugin https://github.com/bertramdev/less-grails-asset-pipeline I get following sintax error during compilation:

2015-08-07 17:03:01,065 [http-bio-8070-exec-2] ERROR [/manga].[default] - Servlet.service() for servlet [default] in context with path [/manga] threw exception [Filter execution threw an exception] with root cause
com.github.sommeri.less4j.Less4jException: Could not compile less. 2 error(s) occurred:
ERROR 183:12 mismatched character 'h' expecting '>'
182:
183: &--highlighted[aria-selected] {
184: background-color: @dropdown-link-active-bg;

ERROR 332:12 mismatched character 'a' expecting '>'
331: margin-top: -1px;
332: &--above {
333: margin-top: 1px;

at com.github.sommeri.less4j.core.ThreadUnsafeLessCompiler.compile(ThreadUnsafeLessCompiler.java:78)
at com.github.sommeri.less4j.LessCompiler$compile.call(Unknown Source)
at asset.pipeline.less.Less4jProcessor.process(Less4jProcessor.groovy:27)
at asset.pipeline.Processor$process.call(Unknown Source)
at asset.pipeline.less.LessAssetFile.processedStream(LessAssetFile.groovy:42)
at asset.pipeline.DirectiveProcessor.fileContents(DirectiveProcessor.groovy:295)
at asset.pipeline.DirectiveProcessor$fileContents$2.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at asset.pipeline.DirectiveProcessor$fileContents$2.call(Unknown Source)
at asset.pipeline.AssetPipeline.serveUncompiledAsset(AssetPipeline.groovy:65)
at asset.pipeline.AssetPipeline$serveUncompiledAsset$1.call(Unknown Source)
at asset.pipeline.grails.AssetPipelineFilter.doFilter(AssetPipelineFilter.groovy:98)

modals?

What is the story with modals? In the previous version I had something like this which allowed it to work fine in modals :

.modal-open .select2-drop-mask {
  z-index: 10051;
}

.modal-open .select2-drop {
  z-index: 10052;
}

.modal-open .select2-search {
  z-index: 10053;
}

the classes have changed obviously so that will not work or maybe even then it won't. I haven't looked deeper into it yet, but if anyone has please share. I did a quick test with the current theme and nothing works in modals... this should be added as a default or at least a commented note in the css with the class names which are affected.

Don't set font-family

I think it's not recommended and it's not required that change font-family of select item because

  • select2.css has not change any font-family
  • Make conflict with default font of project
  • Consume time and bandwidth a little

Adding .input-sm class, and containerCssClass: ':all:' doesnt work for me

Im using select2.full.js
Select2 4.0.3 and Css 0.1.0-beta.8

I put this on select2 config but the select box doesnt open. doesnt show the options
containerCssClass: ':all:'

the problem that I found is that select has a class called "select2"
so when document loads
$(".select2").select2({
width: '100%',
placeholder: function(){
$(this).data('placeholder');
},
containerCssClass: ':all:',
});
it copies the select2 class to the container and that makes all broken.
there is another way to make this without the :all: class ?

on the examples page, this is not happening. Why ? Thanks !!!

Focus is lost for most scenarios when the dropdown list closes

NOTE: This is a Chome and Firefox only bug. (IE 11 works fine)

Focus is lost when you do one of the following:

  • Select an item from the list (Using the filter, arrow keys or mouse)
  • Drop down the pick list then press tab (without selecting anything)

Basically when the dropdown list closes, focus is lost. Pressing tab moves the focus to the first item on the page.

Repro Steps:

  1. Load this URL: https://select2.github.io/examples.html
  2. Click on the second drop down on the page (or any that has Select2 applied)
  3. Select an option
  4. Press Tab
    RESULT: The Logo at the top of the screen is focused.

Tested on Chrome 56 and Firefox 38.5.1 using Windows 7 also tested with Chrome in my app using the latest build as of 3/10/2017.

UPDATE: This bug does not occur if you use the "minimumResultsForSearch: Infinity" option. But then you cannot type to match on items in the list.

Missing dependencies in 'bower.json'?

bower.json chouldn't have select2 as dependency?

This will ensure using the right theme version compatible with select2 version used in own projects.

The same applies to bootstrap.

Select as addon

How can I make select2 as addon, select width - 0px?

<div class="input-group select2-bootstrap-append">
    <input type="text" />
    <span class="input-group-btn">
        <select class="select2"></select>
    </span>                     
</div>

Beta 8 is not usable with rails-assets anymore

Hi all,

since beta8 I can't use this repo with rails-assets anymore (problem relates to the following commit: 494123d)

Rails assets uses bower's main property to decide which files it bundles.. in result of the mentioned commit I don't have the compiled files available anymore. You might want to consider to add the dist files to bower main property again? So long I will use beta7.

image

Cheers Florian

Add focus css

.select2-container--bootstrap.select2-container--focus .select2-selection {
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
  -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
  -o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
  transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
  border-color: #66afe9;
}

clear button style with multiple is absent

There are not css for select2-selection__clear with multiple=true (select2-selection--multiple). Clear button render after inline input, but not at right side of select2 control.
Screenshot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.