Customization
Take advantage of the Thedir 's past, current and future updates, by learning how to create your own content without changing the core styles of Thedir .
How to include a typeface? #
Add or change Thedir typography with the following instructions.
With SASS #
-
Use the $font-family-base attribute as our typographic base applied to the
<body>
in_variables.scss
file to change the current font family variable with yours.$font-family-base: "Poppins", Helvetica, Arial, sans-serif !default;
-
Add your font stylesheet into the
<head>
before all other stylesheets. Like:<!-- CSS Global Compulsory --> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Poppins:300,400,500,600,700">
With CSS #
-
Simply replace the font family
font-family
<body>
instyle.css
tag with yours.body { font-family: "Poppins", Helvetica, Arial, sans-serif; }
-
Add your font stylesheet into the
<head>
before all other stylesheets. Like:<!-- CSS Global Compulsory --> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Poppins:300,400,500,600,700">
SASS #
Utilize our source SASS files to take advantage of variables, mixins, and more.
Whenever possible, avoid modifying Thedir 's core files. For SASS, that means creating your own stylesheet that imports Bootstrap so you can modify and extend it.
Customizing SASS #
To avoid file loss, overrides of your custom styles or any other conflicts during
the upgrade process, create or modify your styles with these 2 files sass/
:
_user-variables.scss
- Variables file for customizing or overriding Bootstrap core and Thedir elements/components that have been tied to variables._user.scss
- Create a new style in here.
Note
Custom files along with Bootstrap core CSS files will be generated in to the
style.css
file.
Variable defaults #
Every SASS variable in Thedir includes the !default
flag allowing you to override
the variable's default value in your own SASS without modifying either Bootstrap
or Thedir 's source code. Copy and paste variables as needed, modify their values,
and remove the !default
flag. If a
variable has already been assigned, then it
won't be re-assigned by the default values in Thedir .
You will find the complete list of Thedir 's variables in sass/_variables.scss
.
Variable overrides within the same SASS file can come before or after the default variables. However, when overriding across SASS files, your overrides must come before you import Thedir 's SASS files.
Here's an example that changes the color of the template in the sass/custom/_custom-variables.scss file when importing and compiling Thedir via npm:
// Your variable overrides
$blue: #377dff; // Primary color
Maps and loops #
Bootstrap 4 includes a handful of SASS maps, key value pairs that make it easier
to generate families of related CSS. We use SASS maps for our colors, grid
breakpoints, and more. Just like SASS variables, all SASS maps include the
!default
flag and can be overridden and
extended.
Some of our SASS maps are merged into empty ones by default. This is done to allow easy expansion of a given SASS map, but comes at the cost of making removing items from a map slightly more difficult.
Modify map #
To modify an existing color in our $theme-colors
map, add the following to
your custom SASS file:
$theme-colors: (
"primary": #377dff,
"danger": #de4437
);
Add to map #
To add a new color to $theme-colors
, add the new key and value:
$theme-colors: (
"custom-color": #000
);
SASS options #
Customize Thedir with our built-in custom variables file and easily toggle global
CSS preferences with $enable-*
SASS
variables.
Variable | Values | Description |
---|---|---|
$spacer |
1rem (default), or any value
> 0
|
Specifies the default spacer value to programmatically generate our spacer utilities . |
$content-space |
1rem (default), or any value
> 0
|
Specifies the default spacer value to programmatically generate our spacer utilities . |
$enable-rounded |
true (default) or false |
Enables predefined border-radius styles on various
components.
|
$enable-shadows |
true or false (default)
|
Enables predefined box-shadow
styles on various components.
|
$enable-accessibility |
true or false (default)
|
Enables predefined accessibility styles on
various components.
|
Color #
Many of Thedir 's various components and utilities are built through a series of colors defined in a SASS map. This map can be looped over in SASS to quickly generate a series of rulesets.
All colors #
All colors available in Thedir , are available as SASS variables and a SASS map in
sass/_variables.scss
file.
Here's how you can use these in your SASS:
.alpha {
color: $primary;
}
// From the SASS map with Bootstrap `color()` function {
.beta {
color: color("purple");
}
Color utility classes are also available for setting color
and background-color
.
Theme colors #
We use a subset of all Bootstrap colors to create a smaller color palette for
generating color schemes, also available as SASS variables and a SASS map in
Thedir 's sass/_variables.scss
file.
Grays #
An expansive set of gray variables and a SASS map in sass/_variables.scss
for
consistent shades of gray across your project.
SASS Components #
Many of Bootstrap's components and utilities are built with @each
loops that
iterate over a SASS map. This is especially helpful for generating variants of a
component by $theme-colors
and creating
responsive variants for each breakpoint.
As you customize these SASS maps and recompile, you'll automatically see your
changes reflected in these loops.
Modifiers #
Many of Bootstrap and Thedir 's components are built with a base-modifier class
approach. This means the bulk of the styling is contained to a base class (e.g.,
.btn
) while style variations are confined
to modifier classes (e.g.,
.btn-danger
). These modifier classes are
built from the $theme-colors
map to
make customizing the number and name of our modifier classes.
Here are two examples of how we loop over the $theme-colors
map to generate
modifiers to the .alert component and all our .bg-*
background utilities.
// Generate alert modifier classes
@each $color, $value in $theme-colors {
.alert-#{$color} {
@include alert-variant(theme-color-level($color, -10), theme-color-level($color, -9), theme-color-level($color, 6));
}
}
// Generate `.bg-*` color utilities
@each $color, $value in $theme-colors {
@include bg-variant('.bg-#{$color}', $value);
}
Customizing JS #
To avoid file loss, overrides of your custom styles or any other conflicts during
the upgrade process, create or modify your styles with js/theme-custom.js
file.