A Customizable Front End Utility Library for Developers
Custility is a powerful set of truly customizable css utility classes, made to greatly aid in the development of potentially large and ambitious websites and apps that need a mountain of flexibility. Every class name and breakpoint can be bent to your will, allowing you to even configure it to your current project’s naming guidelines. These were initially built up by Kris Van Houten, but feel free to contribute!
This library does not focus on visual things like buttons, form inputs, tables, typography, and things of the like, but serves more as a toolbox for your website or app. I am currently working on a separate library that does handle the visual portion, but that will take more time to build.
Get Started
Custilty has several quick start options available:
- Download the latest release.
- Clone the repo:
git clone https://github.com/krivaten/custility.git
. - Install with Bower:
bower install custility
. - Install with npm:
npm install custility
.
Take only what you need to survive
I’ve done my best to make it so that adding Custility to your project doesn’t add any unnecessary size to your compiled files. If there is a particular module you don’t need, then don’t include it in your build. Additionally, all the mixins required for each module are isolated to help ensure my code doesn’t interfere with yours.
Bend it to your will
Provide your own responsive break points or turn them off entirely on a per module basis, customize class names, and change the value of any computed value.
Bro, do you even BEM?
Custility was made with BEM in mind, but if you haven’t jumped on the train yet, we got you covered. Simply change the value of variable name $spacer
to '-'
and you’ll feel right at home. Promise.
Modules
Here’s some of the modules that Custility offers:
Flexbox grid
Yes, another grid. So why did I make this one? Because while moving away from Bootstrap, I needed a FlexBox based grid that was incredibly flexible, allowing me to utilize all the most common uses for FlexBox with the addition or removal of a class. This grid was the result.
Prefixes
By default, responsive breakpoint based class names are generated for you. If you would like to generate non-responsive breakpoint class names, set the variable $include-responsive-grid
to false
. If you do this, the only column prefix will be .col--
, otherwise you will have the following:
Rows
.row
: Creates a row
Columns
.col--xs--
: Adds a column on screens 0px wide and up.col--sm--
: Adds a column on screens 544px wide and up.col--md--
: Adds a column on screens 769px wide and up.col--lg--
: Adds a column on screens 992px wide and up.col--xl--
: Adds a column on screens 1200px wide and up
Suffixes
The suffixes are the values you can append to the end of the row and column prefixes (i.e., .col--xs--8
), to impact the grid layout of the elements. Unless you edit the corresponding alias variable values, your options will be named the following:
Rows
nw
: Prevents the row contents from wrapping (Default)w
: Allows the row contents to wraprow
: Convert a row into a Horizontal Row (Default)col
: Convert a row into a Vertical Rowstr
: Set contents to fill the available heightflush
: Set column to have no margina--fs
: Align row items toflex-start
a--fe
: Align row items toflex-end
a--c
: Align row items tocenter
j--fs
: Justify row contents toflex-start
j--fe
: Justify row contents toflex-end
j--c
: Justify row contents tocenter
j--sb
: Justify row contents tospace-between
j--sa
: Justify row contents tospace-around
Columns
#
: Create Column where # is any column size 1-12o--#
: Offset Column where # is any column size 1-12str
: Set column to fill the available heighta
: Set Column to Auto Width (Requires.row--xs--nw
class on.row
)a--c
: Align Column tocenter
a--fs
: Align Column toflex-start
a--fe
: Align Column toflex-end
first
: Change Column Order to Firstlast
: Change Column Order to Last
Examples
Variables
The following are the variables that are used, along with their default values, which may be modified to your liking.
Display
These utilities allow you to control the display of elements, and are very simple to use.
Prefixes
By default, responsive breakpoint based class names are generated for you. If you would like to generate non-responsive breakpoint class names, set the variable $include-responsive-display
to false
. If you do this, the only display prefix will be .dsp--
, otherwise you will have the following:
.dsp--xs--
: Affects display on screens 0px wide and up.dsp--sm--
: Affects display on screens 544px wide and up.dsp--md--
: Affects display on screens 769px wide and up.dsp--lg--
: Affects display on screens 992px wide and up.dsp--xl--
: Affects display on screens 1200px wide and up
Suffixes
The suffixes are the values you can append to the end of the display prefixes (i.e., .dsp--xs--none
), to impact the visibility and appearance of the element. Unless you edit the corresponding alias variable values, your options will be named the following:
none
: Hides the elementblk
: Displays the element as a blockinl
: Displays the element as inlineinl-blk
: Displays the element as an inline-blocksb
: Displays the element using flexbox’s space-betweensa
: Displays the element using flexbox’s space-around
Examples
Variables
The following are the variables that are used, along with their default values, which may be modified to your liking.
Margin
Within Custility, you can have consistent control over the margin you add to elements.
Prefixes
By default, there are six margin prefixes that determine the size of the margin to be added. While the names and sizes can be changed by overriding the $margin-params
variable, out of the box they are the the following:
.mar--0--
: Removes all margin.mar--xs--
: Adds a margin of 16px.mar--sm--
: Adds a margin of 32px.mar--md--
: Adds a margin of 48px.mar--lg--
: Adds a margin of 64px.mar--xl--
: Adds a margin of 80px
Suffixes
The suffixes that can be added to the margin class give you a lot of flexibility as to where and how margin will be applied. Unless you edit the corresponding alias variable values, your options will be named the following:
t
: Adds margin to the topb
: Adds margin to the bottoml
: Adds margin to the leftr
: Adds margin to the rightx
: Adds margin to the x-axisy
: Adds margin to the y-axis
Examples
Variables
The following are the variables that are used, along with their default values, which may be modified to your liking.
Padding
These utilities allow you to control the padding of elements, and are very simple to use.
Prefixes
By default, there are six padding prefixes that determine the size of the padding to be added. While the names and sizes can be changed by overriding the $padding-params
variable, out of the box they are the the following:
.pad--0--
: Removes all padding.pad--xs--
: Adds a padding of 16px.pad--sm--
: Adds a padding of 32px.pad--md--
: Adds a padding of 48px.pad--lg--
: Adds a padding of 64px.pad--xl--
: Adds a padding of 80px
Suffixes
The suffixes are the values you can append to the end of the padding prefixes (i.e., .pad--md--l
), to impact the padding of the element. Unless you edit the corresponding alias variable values, your options will be named the following:
t
: Adds padding to the topb
: Adds padding to the bottoml
: Adds padding to the leftr
: Adds padding to the rightx
: Adds padding to the x-axisy
: Adds padding to the y-axis
Examples
Variables
The following are the variables that are used, along with their default values, which may be modified to your liking.
Position
These utilities allow you to control the position of elements.
Prefixes
By default, responsive breakpoint based class names are generated for you. If you would like to generate non-responsive breakpoint class names, set the variable $include-responsive-position
to false
. If you do this, the only position prefix will be .pos--
, otherwise you will have the following:
.pos--xs--
: Affects position on screens 0px wide and up.pos--sm--
: Affects position on screens 544px wide and up.pos--md--
: Affects position on screens 769px wide and up.pos--lg--
: Affects position on screens 992px wide and up.pos--xl--
: Affects position on screens 1200px wide and up
Suffixes
The suffixes are the values you can append to the end of the position prefixes (i.e., .pos--xs--rel
), to impact the position of the element. Unless you edit the corresponding alias variable values, your options will be named the following:
abs
: Absolutely positions the elementrel
: Relatively positions the elementl
: Positions the element on the leftr
: Positions the element on the rightt
: Positions the element on the topb
: Positions the element on the bottomtl
: Positions the element on the top lefttr
: Positions the element on the top rightbl
: Positions the element on the bottom leftbr
: Positions the element on the bottomr right
Examples
Variables
The following are the variables that are used, along with their default values, which may be modified to your liking.
Pull
These utilities allow you to controll the float of elements. A pretty small but still useful module.
Prefixes
By default, responsive breakpoint based class names are generated for you. If you would like to generate non-responsive breakpoint class names, set the variable $include-responsive-pull
to false
. If you do this, the only pull prefix will be .pull--
, otherwise you will have the following:
.pull--xs--
: Affects float on screens 0px wide and up.pull--sm--
: Affects float on screens 544px wide and up.pull--md--
: Affects float on screens 769px wide and up.pull--lg--
: Affects float on screens 992px wide and up.pull--xl--
: Affects float on screens 1200px wide and up
Suffixes
The suffixes are the values you can append to the end of the pull prefixes (i.e., .pull--xs--none
), to impact the float of the element. Unless you edit the corresponding alias variable values, your options will be named the following:
l
: Floats the element to the leftr
: Floats the element to the rightnone
: Does not float the element
Examples
Variables
Text
These utilities allow you to control text styling.
Prefixes
By default, responsive breakpoint based class names are generated for you. If you would like to generate non-responsive breakpoint class names, set the variable $include-responsive-text
to false
. If you do this, the only text prefix will be .txt--
, otherwise you will have the following:
.txt--xs--
: Affects text on screens 0px wide and up.txt--sm--
: Affects text on screens 544px wide and up.txt--md--
: Affects text on screens 769px wide and up.txt--lg--
: Affects text on screens 992px wide and up.txt--xl--
: Affects text on screens 1200px wide and up
Suffixes
The suffixes are the values you can append to the end of the text prefixes (i.e., .txt--xs--str
), to impact the text of the element. Unless you edit the corresponding alias variable values, your options will be named the following:
sm
: Resizes the text as smallstr
: Styles the text as boldemp
: Styles the text as italiceli
: Overflow text will be styled with ellipsisl
: Aligns the text to the leftc
: Aligns the text to the centerr
: Aligns the text to the right
Examples
Variables
The following are the variables that are used, along with their default values, which may be modified to your liking.