Code Monkey home page Code Monkey logo

bulma-helpers's Introduction

bulma-helpers

Library with missing Functional / Atomic CSS classes for Bulma framework, which doesn't require Bulma framework to work! ❤️

npm

Quick install

Installation is nearly the same as pure Bulma framework.

NPM

npm install bulma-helpers

or

Yarn

yarn add bulma-helpers

Import

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-borderless

or

.has-padding-top-5

One exception are pure Flexbox classes, which names just reflect modifiers. Example:

.flex-row

or

.align-center

Compatibility 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.

Customizing 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 !default

We'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 !default

Customizing 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 !default

This 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 !default

Customizing breakpoints

Breakpoints are same as default breapoints in Bulma. If you want to change them, then just override the same breakpoint variables as in Bulma, for example:

$tablet: 800px

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 values are represented by pixels, so e.g. has-max-width-50 class means that this element's maximal width is 50px.

Spacing

Margin

Margin
.has-margin-5

gives

margin: 5px !important
Margin for one side
.has-margin-top-5

gives

margin-top: 5px !important
All available sides
  1. top
  2. right
  3. bottom
  4. left
Default available spacing values

(5, 10, 15, ..., 150)

Padding

In the same way as above for margin.

Padding
.has-padding-5
Padding for one side
.has-padding-top-5
All available sides
  1. top
  2. right
  3. bottom
  4. left
Default available spacing values

(5, 10, 15, ..., 150)

Sizing

Width
.has-width-50

gives

width: 50px !important
Height
.has-height-50
Default available sizing values

(50, 100, 150, ..., 400)

Max / min width / height

Max width
.has-max-width-50

gives

width: 50px !important
Min height
.has-min-height-50

gives

min-height: 50px !important
Default available sizing values

(50, 100, 150, ..., 400)

Fraction width / height

Full width
.is-full-width

gives

width: 100% !important
.is-half-height

gives

height: 50% !important
Default available sizing values

full (100%), half (50%), quarter (25%)

Full page width / height

Full page width
.has-page-width

gives

width: 100vw !important
Default 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 !default

Margin

Margin
.has-margin-5-mobile
Margin for one side
.has-margin-top-5-tablet
All available sides
  1. top
  2. right
  3. bottom
  4. left
Default available spacing values

(5, 10, 15, ..., 150)

Padding

In the same way as above for margin.

Padding
.has-padding-5-fullhd
Padding for one side
.has-padding-top-5-widescreen
All available sides
  1. top
  2. right
  3. bottom
  4. 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-desktop

Sizing

Width
.has-width-50-touch
Height
.has-height-50-mobile
Default available sizing values

(50, 100, 150, ..., 400)

Max / min width / height

Max width
.has-max-width-50-desktop
Min height
.has-min-height-50-mobile
Default available sizing values

(50, 100, 150, ..., 400)

Fraction width / height

Full width
.is-full-width-tablet
.is-half-height-widescreen
Default available sizing values

full (100%), half (50%), quarter (25%)

Full page width / height

Full page width
.has-page-width-mobile
Default 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-row
Column
.flex-column
Align content start
.align-start
Justify content center
.justify-center
Align self baseline
.align-self-baseline
Align items flex-end
.align-items-flex-end
Nowrap
.nowrap

Border

Borderless
.is-borderless
Completely borderless

Makes cascade of borderless (applies lack of border to all tr, td and th in the table).

.is-completely-borderless
Border width
.has-border-width-3

gives

border-width: 3px !important
Border width for one side
.has-border-top-width-3

gives

border-top-width: 3px !important
All available sides
  1. top
  2. right
  3. bottom
  4. left
Default available sizing values

(1, 2, 3, ..., 10)

Cursor

Cursor's style
.has-cursor-pointer

gives

cursor: pointer !important
All available cursors
  1. pointer
  2. grab
  3. help
  4. wait
  5. crosshair
  6. not-allowed
  7. zoom-in

Misc

Blur
.is-blurred

gives

filter: blur(15px) !important
Blur medium
.is-blurred-medium

gives

filter: blur(40px) !important
Blur hard
.is-blurred-hard

gives

filter: blur(75px) !important
Default 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.

bulma-helpers's People

Contributors

jmaczan avatar log1x avatar thattimc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.