5
5
6
6
While BootstrapVue uses Bootstrap's CSS, certain features of BootstrapVue uses custom CSS (i.e.
7
7
stacked tables, etc). Our custom CSS relies on variables defined the Bootstrap v4.x SCSS. The
8
- ` bootstrap-vue.css ` is compiled using the default Bootstrap v4.x variables. Using the BootstrapVue
9
- source SCSS, you can have your variable overrides (such as breakpoints, etc) adjust the custom
10
- BootstrapVue css.
8
+ ` bootstrap-vue/dist/bootstrap-vue .css ` is compiled using the default Bootstrap v4.x variables. By
9
+ using the BootstrapVue source SCSS, you can have your variable overrides (such as breakpoints, theme
10
+ colors, etc) adjust the custom BootstrapVue css generation .
11
11
12
12
## SASS variable defaults
13
13
14
- Every Sass variable in Bootstrap 4 includes the ` !default ` flag allowing you to override the
15
- variable’s default value in your own Sass without modifying Bootstrap’s source code. Copy and paste
16
- variables as needed, modify their values, and remove the ` !default ` flag. If a variable has already
17
- been assigned, then it won’t be re-assigned by the default values in Bootstrap.
14
+ Every Sass variable in Bootstrap v4 includes the ` !default ` flag allowing you to override the
15
+ variable’s default value in your own Sass without modifying Bootstrap and BootstrapVue's source SCSS
16
+ code. Copy and paste variables as needed, modify their values, and remove the ` !default ` flag. If a
17
+ variable has already been assigned, then it won’t be re-assigned by the default values in Bootstrap
18
+ and BootstrapVue.
18
19
19
20
You will find the complete list of Bootstrap’s variables in ` bootstrap/scss/_variables.scss ` . Some
20
21
variables are set to ` null ` , these variables don’t output the property unless they are overridden in
21
22
your configuration.
22
23
23
24
Variable overrides within the same Sass file can come before or after the default variables.
24
- However, when overriding across Sass files, your overrides must come _ before_ you import Bootstrap’s
25
- Sass files.
25
+ However, when overriding across Sass files, your overrides must come _ before_ you import Bootstrap
26
+ and BootstrapVue's Sass (SCSS) files.
26
27
27
28
Here’s an example that changes the ` background-color ` and ` color ` for the ` <body> ` when importing
28
- and compiling Bootstrap SCSS:
29
+ and compiling Bootstrap and BootstrapVue SCSS:
29
30
30
31
``` scss
31
32
// Your variable overrides
@@ -93,20 +94,22 @@ Some commonly used Bootstrap v4 variables are:
93
94
| ` $enable-validation-icons ` | Boolean | ` true ` | Enables ` background-image ` icons within textual inputs and some custom forms for validation states |
94
95
95
96
Refer to [ Bootstrap's theming] ( https://getbootstrap.com/docs/4.3/getting-started/theming/ ) docs for
96
- additional variable information.
97
+ additional Bootstrap v4 variable information.
97
98
98
- BootstrapVue also defines several SCSS variables for controlling BootstrapVue's custom CSS
99
- generation:
99
+ BootstrapVue also defines several Sass variables for controlling BootstrapVue's custom CSS
100
+ generation. If you are not using these features in your project, you can disable the feature's CSS
101
+ generation to reduce the size of BootstrapVue's custom CSS bundle:
100
102
101
- | Variable | Type | Default | Description |
102
- | ----------------------------- | ------- | ------- | -------------------------------------- |
103
- | ` $bv-enable-table-stacked ` | Boolean | ` true ` | Enables stacked table CSS generation |
104
- | ` $bv-enable-tooltip-variants ` | Boolean | ` true ` | Enables tooltip variant CSS generation |
105
- | ` $bv-enable-popover-variants ` | Boolean | ` true ` | Enables popover variant CSS generation |
103
+ | Variable | Type | Default | Description |
104
+ | ----------------------------- | ------- | ------- | ----------------------------------------------------- |
105
+ | ` $bv-enable-table-stacked ` | Boolean | ` true ` | Enables stacked table CSS generation |
106
+ | ` $bv-enable-table-sticky ` | Boolean | ` true ` | Enables sticky table header and column CSS generation |
107
+ | ` $bv-enable-tooltip-variants ` | Boolean | ` true ` | Enables tooltip variant CSS generation |
108
+ | ` $bv-enable-popover-variants ` | Boolean | ` true ` | Enables popover variant CSS generation |
106
109
107
110
You can find additional variables that control various aspects of BootstrapVue's custom CSS at
108
111
[ ` bootstrap-vue/src/_variables.scss ` ] ( https://github.com/bootstrap-vue/bootstrap-vue/blob/master/src/_variables.scss ) .
109
- BootstrapVue's custom SCSS relies on Bootstrap's SASS variables, functions, and mixins.
112
+ Note that BootstrapVue's custom SCSS relies on Bootstrap's SASS variables, functions, and mixins.
110
113
111
114
## Generating custom themes
112
115
@@ -117,23 +120,30 @@ your project, which you can include in your main app:
117
120
118
121
``` html
119
122
<style lang =" scss" >
123
+ // Import custom SASS variable overrides
120
124
@import ' assets/custom.scss' ;
125
+ // Import Bootstrap and BootstrapVue source SCSS files
121
126
@import ' ~bootstrap/scss/bootstrap.scss' ;
122
127
@import ' ~bootstrap-vue/src/index.scss' ;
123
128
129
+ // General style overrides and custom classes
124
130
body {
125
131
margin : 0 ;
126
132
}
127
133
// ...
128
134
</style >
129
135
```
130
136
137
+ The `custom.scss` file, which needs to be loaded before Bootstrap's SCSS and BootstrapVue's SCSS,
138
+ will include your Bootstrap v4 variable overrides (i .e . colors, shadows, font sizes, breakpoints,
139
+ etc).
140
+
131
141
** Via app main entry point:**
132
142
133
- Create an SCSS file:
143
+ Create an SCSS file with your custom theme variables :
134
144
135
145
```scss
136
- // custom.scss
146
+ // File: custom.scss
137
147
138
148
// Define your variable overrides here
139
149
$enable-shadows : true;
@@ -145,10 +155,17 @@ $grid-breakpoints: (
145
155
lg: 999px,
146
156
xl: 1234px
147
157
);
158
+ $bv-enable-table-stacked : false;
148
159
149
160
// Include Bootstrap and BootstrapVue SCSS files
150
161
@import ' ~bootstrap/scss/bootstrap.scss' ;
151
162
@import ' ~bootstrap-vue/src/index.scss' ;
163
+
164
+ // General style overrides and custom classes
165
+ body {
166
+ margin : 0 ;
167
+ }
168
+ // ...
152
169
```
153
170
154
171
Then import that single SCSS file into your app code entry point:
@@ -158,9 +175,7 @@ Then import that single SCSS file into your app code entry point:
158
175
import 'custom.scss'
159
176
```
160
177
161
- The `custom.scss` file, which needs to be loaded before Bootstrap's SCSS, will include your
162
- Bootstrap v4 variable overrides (i .e . colors, shadows, font sizes, breakpoints, etc). You can find
163
- all of the possible variables in `node_modules/bootstrap/scss/_variables.scss`.
178
+ You can find all of the possible variables in `node_modules/bootstrap/scss/_variables.scss`.
164
179
165
180
Do not forget to include `node-sass ` and `sass-loader ` to use `scss` in Vue:
166
181
@@ -221,8 +236,8 @@ Here are the variables that are generated. The values shown are based on the Boo
221
236
}
222
237
```
223
238
224
- By setting SASS variables and maps, and recompiling the SCSS, will update the above generated CSS
225
- variables .
239
+ By setting SASS variables and maps, and recompiling the SCSS, the above generated SCSS variables
240
+ will also be updated .
226
241
227
242
### Example
228
243
0 commit comments