You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Bolts is a front-end helper library, consisting of practical Sass mixins and functions, along with a collection of JavaScript functions, helping you deal with all the mundane website building and styling tasks, so that you can focus on creating something new. It aims to be a toolkit that takes care of the things you're tired of doing.
Bolts doesn't output any unnecessary styles, and all JavaScript functions can be loaded separately through ES6+ imports, making its footprint as tiny as possible.
Installation
npm
npm i bolts-lib
yarn
yarn add bolts-lib
Sass
Usage
Including Bolts in your Sass files
@import '~bolts-lib/src/sass/bolts';
Configuration variables
Define any of the following variables before including Bolts to set default options for many of the mixins and functions.
Variable name
Example value
Description
$bolts-reset-focus-styles
true
Removes outline on:focus state
$bolts-reset-list-styles
true
Resetslist-style on all<ul> and<ol> elements
$bolts-reset-legacy-element-styles
true
Resets styles on some deprecated elements (such as font, marquee, blink, nobr and more
$bolts-default-sticky-footer-wrapper-selector
'> *:first-child'
Selector for wrapper (content without footer) used by sticky-footer mixin
$bolts-default-sticky-footer-footer-selector
'> footer'
Selector for footer used by sticky-footer mixin
$bolts-default-pseudo
before
Pseudo selector used by aspect-ratio, clear and vertical-align mixins if argument is not passed
$bolts-default-font-path
'../fonts'
$path used by font mixin if argument is not passed
$bolts-default-container-width
90%
$width used by container mixin if argument is not passed
$bolts-default-container-max-width
1080px
$max-width used by container mixin if argument is not passed
$bolts-default-container-align
center
'$align' used by container mixin if argument is not passed
$bolts-default-inline-layout-align
top
$align used by inline-layout mixin if argument is not passed
$bolts-default-inline-layout-gutters
20px
$gutters used by inline-layout mixin if argument is not passed
$bolts-default-flex-layout-align
top
$align used by flex-layout mixin if argument is not passed
$bolts-default-flex-layout-gutters
20px
$gutters used by flex-layout mixin if argument is not passed
$bolts-default-background-image
'../images/bg.jpg'
$image used by background mixin if argument is not passed
$bolts-default-background-size
cover
$size used by backgound mixin if argument is not passed
$bolts-default-background-position
50% 50%
$position used by backgound mixin if argument is not passed
$bolts-default-background-repeat
repeat
$repeat used by backgound mixin if argument is not passed
$bolts-default-background-attachment
fixed
$attachment used by backgound mixin if argument is not passed
$bolts-default-background-color
#ddd
$color used by backgound mixin if argument is not passed
$bolts-default-transition-property
opacity
$property used by transition mixin if argument is not passed
$bolts-default-transition-duration
0.2s
$duration used by transition mixin if argument is not passed
$bolts-default-transition-easing
ease-in-out
$easing used by transition mixin if argument is not passed
$bolts-default-transition-delay
0.1s
$delay used by transition mixin if argument is not passed
$bolts-default-transition-queue
true
Enables queue with default property on transition mixin unless overwritten
$bolts-default-transition-queue-property
visibility
$queue (property) used by transition mixin if argument is not passed
$bolts-default-transition-queue-duration
0s
$queue-duration used by transition mixin if argument is not passed
$bolts-default-transition-queue-easing
linear
$queue-easing used by transition mixin if argument is not passed
$bolts-default-auto-col-min
1
$min (minimum amount of columns) used by auto-col mixin if argument is not passed
$bolts-default-auto-col-max
12
$max (maximum amount of columns) used by auto-col mixin if argument is not passed
$bolts-default-responsive-font-size-ratio
1.6
$ratio used by responsive-font-size mixin if argument is not passed
$bolts-breakpoints
(medium: 500px)
Breakpoints that can be accessed by the width and height functions when writing media queries
$bolts-selectors
(headings: 'h1, h2')
Map containing element collections that can be accessed by theselect mixin
$bolts-easings
( ease-in-quad: '0.55, 0.085, 0.68, 0.53' )
Map containing element collections that can be accessed by theselect mixin
Functions
Breakpoint
width()
width-from()
width-to()
height()
height-from()
height-to()
Functions to run inside your@media queries that lets you access your defined breakpoints. It automatically compensates your pixel values to prevent duplicate properties being set.
Returns a cubic-bezier with the specified easing.If a named easing if supplied, it looks for easings defined in $bolts-easings, otherwise the supplied value is used directly.
Name
Accepted values
Description
$easing
CSS standard named easings, cubic-bezier, or key name from the$bolts-easings map
What height value to base the ratio calculation on
Classic clearfix
clear()
This mixin currently has no description
Usage:
// This mixin currently has no example
Arguments:
Name
Accepted values
Default value
Description
-
-
-
-
Element centering
center()
Center an element inside it's closest relatively positioned parent in either, or both direction (vertical/horizontal)
Known issue: Some browsers positions the element "between pixels", making it appear blurred. Usetransform-style: preserve-3d on the parent to avoid this.
The inline-layout component is another take on layouts, where the columns areinline-block elements, which eliminates the need for rows, and makes them respond to text-align. This is especially useful for dynamic content.