bulma-helpers v0.4.3
bulma-helpers
Library with missing Functional / Atomic CSS classes for Bulma framework, which doesn't require Bulma framework to work
- bulma-helpers
No installation (CDN)
You can use Bulma Helpers without installation directly from cdnjs. Just import file bulma-helpers.min.css:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma-helpers/0.4.0/css/bulma-helpers.min.css" integrity="sha512-U6ELnUi7oqVEjkLmFw5r5UR5LEtvpImS/jUykBKneVhD0lxZxfJZ3k3pe003ktrtNZYungd9u3Urp2X09wKwXg==" crossorigin="anonymous" />Link to library on cdnjs:
https://cdnjs.com/libraries/bulma-helpersQuick install
Installation is nearly the same as pure Bulma framework.
NPM
npm install bulma-helpersor
Yarn
yarn add bulma-helpersImport
After installation, you can import the CSS file into your project using this snippet:
import 'bulma-helpers/css/bulma-helpers.min.css'Compatibility with Bulma
Bulma-helpers library complies with Bulma convention of naming classes. Most of classes are of the is-* and has-* type. Example:
.is-borderlessor
.has-padding-top-5One exception are pure Flexbox classes, which names just reflect modifiers. Example:
.flex-rowor
.align-centerCompatibility with other CSS frameworks
You can use Bulma-helpers with any other CSS framework or even as a standalone library, if you want to write Functional / Atomic CSS code. Keep in mind that Bulma-helpers library bases on Sass, so you will need basic knowledge of Sass to customize the library.
CSS only
Bulma-helpers, equally to Bulma, is a CSS library. As such, the sole output is a single CSS file: bulma-helpers.css
You can either use that file, "out of the box", or download the Sass source files to customize the variables or choose which modules do you want to use.
There is no JavaScript included.
Browser Support
Bulma-helpers, equally to Bulma, uses autoprefixer to make (most) Flexbox features compatible with earlier browser versions. According to Can I use, Bulma is compatible with recent versions of:
- Chrome
- Edge
- Firefox
- Opera
- Safari
Internet Explorer (10+) is only partially supported.
Customization
All modules are toggled on and all variables have some values by default. You can customize these values by assigning your values to variables, defined in the library. All available variables you can find in corresponding files in variables directory. Toggling off media queries (variables for this you can find in sass/helpers/variables/media-queries.sass, for example $enable-flex-media-queries) will decrease size of the library dramatically.
Instruction
- Make sure you have
node-sassinstalled. If not, install it. (npm install node-sass --save-dev) - Create script for compiliting
SCSStoCSS, i.e."customize-css": "node-sass --omit-source-map-url ./src/scss/bulma-helpers-customization.scss ./src/css/bulma-helpers-customization.css". Add this script toscriptssection inpackage.json. As you can see in script, our file in which we will customizebulma-helpersis calledbulma-helpers-customization.scss. The resultCSSoutput will be inbulma-helpers-customization.css(notice the different extension of file). - Create
SCSSfile in which you will customizebulma-helpersvariables (i.e.scss/bulma-helpers-customization.scss) - Define variables which you want to override, before importing
bulma-helpersin created file.
Example content of file with customization:
@charset "utf-8";
$sizing-range-start: 1;
$sizing-range-end: 666;
$sizing-interval: 6;
@import "../../node_modules/bulma-helpers/bulma-helpers.sass";- Run compiling script to build new
cssfile, i.e.npm run customize-css - Import result file (in this example -
bulma-helpers-customization.css) in your scss file, i.e.@import "css/bulma-helpers-customization.css";
Customizing unit
Default unit in code and in this README is px, but you can change it to any unit, for example em or rem. Change will be global for all helpers.
$default-unit: 'px' !defaultCustomizing ranges of generated classes
For all generated classes (such as has-margin-bottom-*, where * is value from given range) there is a simple way to change range and interval of generated classes. You can change the following variables in corresponding sass files. All variables follow the same pattern, shown below.
$sizing-range-start: 50 !default
$sizing-range-end: 400 !default
$sizing-interval: 50 !defaultWe've got name of customized value, such as sizing or spacing, then variable's meaning, such as range-start, range-end and interval.
For media queries, the rule is the same. The only difference is that rest of variable's name is preceded by mq.
$mq-sizing-range-start: 50 !default
$mq-sizing-range-end: 400 !default
$mq-sizing-interval: 50 !defaultCustomizing media queries
You can decide whether you want to include media queries in your project or not. In variables/media-queries.sass file you can find variables which allows you to customize your Bulma-helpers. All of defined variables are built on top of the following pattern:
$enable-media-queries: true !defaultThis variables enables/disables all media queries in the project.
For choosing certain modules, such as max/min width/height sizing media queries, you can assign a value to variables such as:
$enable-sizing-max-min-width-height-media-queries: true !defaultCustomizing breakpoints
Breakpoints are same as default breakpoints in Bulma. If you want to change them, then just override the same breakpoint variables as in Bulma, for example:
$tablet: 800pxCustomizing spacing units
Units for the spacing and media query spacing helpers are using pixels by default. If you want to generate classes for additional units (such as rem or em), override the list of unit variables, which allows for a single unit or list of units. For example:
$additional-spacing-units: 'rem' 'em'Generated spacing and media query classes for the above configuration will result in new spacing classes appended with -rem or -em. For example, has-margin-5-rem and has-margin-5-em.
Choosing modules
By default, all modules are included in result build. Even so, you can decide on your own which modules do you want to use in your project.
To achieve this, you have to remove unwanted sass modules imports from main _all.sass files in helpers directory or remove single file imports from _all.sass in corresponding modules directories.
Documentation
All customization variables
// --- MEDIA QUERIES
// ALL
$enable-media-queries: true !default // set to false if you don't want to include media queries at all
// spacing - MARGIN / PADDING
$enable-spacing-media-queries: true !default // set to false if you don't want to include ALL MARGIN / PADDING media queries
// sizing - WIDTH / HEIGHT
$enable-sizing-media-queries: true !default // set to false if you don't want to include ALL WIDTH / HEIGHT media queries
$enable-sizing-width-height-media-queries: true !default // set to false if you don't want to include WIDTH / HEIGHT
$enable-sizing-max-min-width-height-media-queries: true !default // set to false if you don't want to include MAX-WIDTH / MAX-HEIGHT / MIN-WIDTH / MIN-HEIGHT
$enable-sizing-misc-media-queries: true !default // set to false if you don't want to include OTHERS
// flex
$enable-flex-media-queries: true !default // set to false if you don't want to include FLEXBOX media queries
$enable-flex-core-media-queries: true !default // set to false if you don't want to include FLEXBOX CORE
$enable-flex-align-self-items-media-queries: true !default // set to false if you don't want to include ALIGN-SELF / ALIGN-ITEMS
$enable-flex-align-justify-media-queries: true !default // set to false if you don't want to include ALIGN-CONTENT / JUSTIFY-CONTENT
// --- BREAKPOINTS - Default values of responsiveness breakpoints. They are equal to Bulma v0.7.2 breakpoints.
// The container horizontal gap, which acts as the offset for breakpoints
$gap: 64px !default
// 960, 1152, and 1344 have been chosen because they are divisible by both 12 and 16
$tablet: 769px !default
// 960px container + 4rem
$desktop: 960px + (2 * $gap) !default
// 1152px container + 4rem
$widescreen: 1152px + (2 * $gap) !default
$widescreen-enabled: true !default
// 1344px container + 4rem
$fullhd: 1344px + (2 * $gap) !default
$fullhd-enabled: true !default
// --- WIDTH / HEIGHT
$sizing-range-start: 50 !default // from this value WIDTH / HEIGHT classes will be generated (i.e. has-width-50)
$sizing-range-end: 400 !default // to this value will be generated WIDTH / HEIGHT classes (i.e. has-height-400)
$sizing-interval: 50 !default // this will be gap between previous and next class (i.e. has-width-50, has-width-100, has-width-150 and so on)
$sizing-max-min-width-height-range-start: $sizing-range-start !default // from this value MAX / MIN WIDTH / HEIGHT classes will be generated (i.e. has-max-width-50)
$sizing-max-min-width-height-range-end: $sizing-range-end !default // to this value will be generated WIDTH / HEIGHT classes (i.e. has-min-height-400)
$sizing-max-min-width-height-interval: $sizing-interval !default // this will be gap between previous and next class (i.e. has-min-width-50, has-min-width-100, has-min-width-150 and so on)
$mq-sizing-range-start: $sizing-range-start !default // from this value WIDTH / HEIGHT classes will be generated for media queries (i.e. .has-width-50-mobile)
$mq-sizing-range-end: $sizing-range-end !default // to this value will be generated WIDTH / HEIGHT classes (i.e. has-height-400-tablet)
$mq-sizing-interval: $sizing-interval !default // this will be gap between previous and next class (i.e. has-width-50-mobile, has-width-100-mobile, has-width-150-mobile and so on)
$mq-sizing-max-min-width-height-range-start: $sizing-max-min-width-height-range-start !default // from this value MAX / MIN WIDTH / HEIGHT classes will be generated for media queries (i.e. has-max-width-50-tablet)
$mq-sizing-max-min-width-height-range-end: $sizing-max-min-width-height-range-end !default // to this value will be generated WIDTH / HEIGHT classes (i.e. has-min-height-400-fullhd)
$mq-sizing-max-min-width-height-interval: $sizing-max-min-width-height-interval !default // this will be gap between previous and next class (i.e. has-min-width-50-fullhd, has-min-width-50-fullhd, has-min-width-50-fullhd and so on)
// --- MARGIN / PADDING
$spacing-range-start: 5 !default // from this value MARGIN / PADDING classes will be generated (i.e. has-margin-5)
$spacing-range-end: 150 !default // to this value will be generated MARGIN / PADDING classes (i.e. has-padding-150)
$spacing-interval: 5 !default // this will be gap between previous and next class (i.e. has-padding-5, has-padding-10, has-padding-15 and so on)
$mq-spacing-range-start: $spacing-range-start !default // from this value MARGIN / PADDING classes will be generated for media queries (i.e. .has-margin-5-mobile)
$mq-spacing-range-end: $spacing-range-end !default // to this value will be generated MARGIN / PADDING classes (i.e. has-padding-150-tablet)
$mq-spacing-interval: $spacing-interval !default // this will be gap between previous and next class (i.e. has-padding-5-mobile, has-padding-10-mobile, has-padding-15-mobile and so on)
$additional-spacing-units: () !default // this can be configured with additional unit type(s) to use for the spacing and media query spacing helpersAll values are represented by pixels with the exception for the spacing helpers, which allows for configuration of additional units, so e.g. has-max-width-50 class means that this element's maximal width is 50px.
Spacing
Margin
Margin
.has-margin-5gives
margin: 5px !importantMargin for one side
.has-margin-top-5gives
margin-top: 5px !importantAll available sides
- top
- right
- bottom
- left
Default available spacing values
(5, 10, 15, ..., 150)
Padding
In the same way as above for margin.
Padding
.has-padding-5Padding for one side
.has-padding-top-5All available sides
- top
- right
- bottom
- left
Default available spacing values
(5, 10, 15, ..., 150)
Sizing
Width
.has-width-50gives
width: 50px !importantHeight
.has-height-50Default available sizing values
(50, 100, 150, ..., 400)
Max / min width / height
Max width
.has-max-width-50gives
width: 50px !importantMin height
.has-min-height-50gives
min-height: 50px !importantDefault available sizing values
(50, 100, 150, ..., 400)
Fraction width / height
Full width
.is-full-widthgives
width: 100% !important.is-half-heightgives
height: 50% !importantDefault available sizing values
full (100%), half (50%), quarter (25%)
Full page width / height
Full page width
.has-page-widthgives
width: 100vw !importantDefault available sizing values
full (100vw/vh), half (50vw/vh), quarter (25vw/vh)
Media queries
By default, media queries for sizing and spacing are toggled on. You can use media queries in exactly the same as in Bulma framework. Just add postfix to classname with breakpoints name, such as -mobile or -widescreen-only.
Default breakpoints
There are few defined breakpoints - mobile, tablet, tablet-only, touch, desktop, desktop-only, widescreen, widescreen-only, fullhd. Everything as in Bulma! You can read more here.
$gap: 64px !default
$tablet: 769px !default
$desktop: 960px + (2 * $gap) !default
$widescreen: 1152px + (2 * $gap) !default
$widescreen-enabled: true !default
$fullhd: 1344px + (2 * $gap) !default
$fullhd-enabled: true !defaultMargin
Margin
.has-margin-5-mobileMargin for one side
.has-margin-top-5-tabletAll available sides
- top
- right
- bottom
- left
Default available spacing values
(5, 10, 15, ..., 150)
Padding
In the same way as above for margin.
Padding
.has-padding-5-fullhdPadding for one side
.has-padding-top-5-widescreenAll available sides
- top
- right
- bottom
- left
Default available spacing values
(5, 10, 15, ..., 150)
Flex
For all flex classes you can do all the responsive things. For example:
.flex-mobile.justify-center-desktopSizing
Width
.has-width-50-touchHeight
.has-height-50-mobileDefault available sizing values
(50, 100, 150, ..., 400)
Max / min width / height
Max width
.has-max-width-50-desktopMin height
.has-min-height-50-mobileDefault available sizing values
(50, 100, 150, ..., 400)
Fraction width / height
Full width
.is-full-width-tablet.is-half-height-widescreenDefault available sizing values
full (100%), half (50%), quarter (25%)
Full page width / height
Full page width
.has-page-width-mobileDefault available sizing values
full (100vw/vh), half (50vw/vh), quarter (25vw/vh)
Flex
Names of classes reflect modifiers. There are modifiers for: 1. row 2. column 3. align-content 4. justify-content 5. align-self 6. align-items 7. wrap
Examples:
Row
.flex-rowColumn
.flex-columnAlign content start
.align-startJustify content center
.justify-centerAlign self baseline
.align-self-baselineAlign items flex-end
.align-items-flex-endNowrap
.nowrapBorder
Borderless
.is-borderlessCompletely borderless
Makes cascade of borderless (applies lack of border to all tr, td and th in the table).
.is-completely-borderlessBorder width
.has-border-width-3gives
border-width: 3px !importantBorder width for one side
.has-border-top-width-3gives
border-top-width: 3px !importantAll available sides
- top
- right
- bottom
- left
Default available sizing values
(1, 2, 3, ..., 10)
Cursor
Cursor's style
.has-cursor-pointergives
cursor: pointer !importantAll available cursors
- pointer
- grab
- help
- wait
- crosshair
- not-allowed
- zoom-in
- default
Misc
Blur
.is-blurredgives
filter: blur(15px) !importantBlur medium
.is-blurred-mediumgives
filter: blur(40px) !importantBlur hard
.is-blurred-hardgives
filter: blur(75px) !importantDefault values for blurs
(15px, 40px, 75px)
Copyright and license
Code copyright 2018 Jędrzej Maczan. Code released under the MIT license. README bases on Bulma README file.
3 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago