Skip to content

Commit

Permalink
Import angel-vladov gist
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed May 11, 2017
1 parent 8f83386 commit 03ded46
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/select2-bootstrap4.after.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Import this file after select2 bootstrap theme. Content won't be centered if you don't include this file.
.select2-container--bootstrap {
.select2-selection--multiple {
.select2-selection__choice {
margin-top: calc(#{$s2bs-padding-base-vertical} - 1px);
}

.select2-search--inline .select2-search__field {
height: $s2bs-input-height-base;
}
}

.select2-selection--multiple.input-sm,
.input-group-sm & .select2-selection--multiple,
.form-group-sm & .select2-selection--multiple {
.select2-selection__choice {
margin-top: calc(#{$s2bs-padding-small-vertical} - 1px);
}

.select2-search--inline .select2-search__field {
height: $s2bs-input-height-small;
}
}

.select2-selection--multiple.input-lg,
.input-group-lg & .select2-selection--multiple,
.form-group-lg & .select2-selection--multiple {
.select2-selection__choice {
margin-top: calc(#{$s2bs-padding-large-vertical} - 1px) ;
}

.select2-search--inline .select2-search__field {
height: $s2bs-input-height-large;
}
}
}
31 changes: 31 additions & 0 deletions src/select2-bootstrap4.vars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Overrides of Select2 SASS variables to make it work with Bootstrap 4 and match its look.
// Import this BEFORE https://github.com/select2/select2-bootstrap-theme SASS files or SASS compilation will fail
// Since there is no official Bootstrap 4 theme for Select 2 this is a good fallback.

$s2bs-input-border: $input-border-color !default;
$s2bs-clear-selection-hover-color: $btn-secondary-color !default;
$s2bs-remove-choice-hover-color: $btn-secondary-color !default;
$s2bs-border-radius-base: $border-radius !default;
$s2bs-border-radius-large: $border-radius-lg !default;
$s2bs-border-radius-small: $border-radius-sm !default;
$s2bs-btn-default-bg: $btn-secondary-bg !default;
$s2bs-btn-default-border: $btn-secondary-border !default;
$s2bs-caret-width-base: .25rem !default; // 4px
$s2bs-caret-width-large: .3125rem !default; // 5px
$s2bs-font-size-base: $font-size-base !default;
$s2bs-font-size-large: $font-size-lg !default;
$s2bs-font-size-small: $font-size-sm !default;
$s2bs-padding-base-horizontal: $input-padding-x !default;
$s2bs-padding-large-horizontal: $input-padding-x-lg !default;
$s2bs-padding-small-horizontal: $input-padding-x-sm !default;
$s2bs-padding-base-vertical: $input-padding-y !default;
$s2bs-padding-large-vertical: $input-padding-y-lg !default;
$s2bs-padding-small-vertical: $input-padding-y-sm !default;
$s2bs-line-height-base: $input-line-height !default;
$s2bs-line-height-large: $input-line-height !default;
$s2bs-line-height-small: $input-line-height !default;
$s2bs-input-height-base: calc(#{$input-padding-y * 2 + $input-line-height} + #{$border-width * 2}) !default;
$s2bs-input-height-large: calc(#{$input-padding-y-lg * 2 + $input-line-height} + #{$border-width * 2}) !default;
$s2bs-input-height-small: calc(#{$input-padding-y-sm * 2 + $input-line-height} + #{$border-width * 2}) !default;

$s2bs-selection-choice-border-radius: $border-radius !default;

0 comments on commit 03ded46

Please sign in to comment.