![]() |
VOOZH | about |
Bootstrap 5 Range SASS has a set of variables with default values that can be changed to customize the container. We can customize the range component by changing the default value of the variables.
Bootstrap 5 Range SASS variables :
Steps to override SCSS of Bootstrap:
Step 1: Install bootstrap using the following command
npm i bootstrap
Step 2: Create your custom scss file and write the variable you want to override. Then include the bootstrap scss file using import.
@import "../node_modules/bootstrap/scss/bootstrap.scss"; $variable_to_override: value;
Step 3: Convert the SCSS file to CSS using a live server extension.
Step 4: Include the CSS file in your HTML file.
<link rel="stylesheet" href="./assets/css/style.css">
Project Structure:
Syntax :
$form-range-thumb-border: value;
$form-range-thumb-border-radius: value;
**
.form-range {
&::-webkit-slider-thumb {
border: $form-range-thumb-border;
@include border-radius($form-range-thumb-border-radius);
}
}
Note: The '**' in the above syntax means that other variables can be added.
Example 1: In this example, the $form-range-track-width, $form-range-track-height, $form-range-track-bg variables are used.
style.scss
style.css
index.html:
Output:
Example 2: In this example, the $form-range-thumb-border and $form-range-thumb-border-radius variables are used in the below example to change the border and border radius of the thumb.
style.scss
style.css
index.html:
Output:
References: https://getbootstrap.com/docs/5.0/forms/range/#sass