Search/

Helpers

Last modified:

Reusable helpers, available as classes for easy-use.

Overview

Last modified:

Full documentation is found in the SassDoc reference for Helpers.

This module provides a number of simple classes that aim to do just one thing.

Single-property helper classes

PropertyPurpose
.bc-helper-nomarginsets margin: 0
.bc-helper-nopaddingsets padding: 0
.bc-helper-centeredtextsets text-align: center
.bc-helper-cursorpointersets cursor: pointer
.bc-helper-righttextsets text-align: right
.bc-helper-noprinthides content for @media print
.bc-helper-printonlyhides content for @media screen
.bc-helper-blocksets display: block
.bc-helper-inlinesets display: inline
.bc-helper-inlineblocksets display: inline-block

Note that most of these helpers include !important to ensure the single property they provide actually overrides as intended.

Mixin implementation helper classes

The more complex helpers are just class implementations of our pre-made mixins from _config.scss, eg:

PropertyPurpose
.bc-helper-clearfixprovides the bc-clearfix() mixin styles.
.bc-helper-sronlyprovides the bc-sronly() (screen reader only; visually-hidden) mixin styles.

When to use helpers

Use the single-property helpers when editing markup over stylesheets is preferable or the only viable solution.

We try to avoid high specificities in our stylesheets --- along with !important overrides. These classes are a compromising balance to provide utility classes that guarantee an override without adding them to app stylesheets.

Margin

Last modified:

Margin helpers use base-4 spacing system to maintain a consistent layout. The helpers cover the most common set of sizes we need for custom margins.

Note the spacing units aren’t linearly-stepped.

For any margin larger than supported sizes, please continue to use the bc-space()SASS function.

Margin naming convention

Side (optional)Definition
ttop
rright
bbottom
lleft
xhorizontal (right and left)
yvertical (top and bottom)
SizePixelRem
autoN/AN/A
000
14px0.25rem
28px0.5rem
316px1rem
420px1.25rem
524px1.5rem
632px2rem
740px2.5rem
848px3rem

Margin on all sides

Margin classDefinition
.bc-m-0margin: 0;
.bc-m-1margin: 0.25rem;

Margin on horizontal sides

Margin classDefinition
.bc-mx-automargin-right: auto; margin-left: auto;
.bc-mx-0margin-right: 0; margin-left: 0;
.bc-mx-1margin-right: 0.25rem; margin-left: 0.25rem;

Margin on vertical sides

Margin classDefinition
.bc-my-automargin-top: auto; margin-bottom: auto;
.bc-my-0margin-top: 0; margin-bottom: 0;
.bc-my-1margin-top: 0.25rem; margin-bottom: 0.25rem;

Margin on one side

Margin classDefinition
.bc-mt-0margin-top: 0;
.bc-mt-1margin-top: 0.25rem;
.bc-mr-0margin-right: 0;
.bc-mr-1margin-right: 0.25rem;
.bc-mb-0margin-bottom: 0;
.bc-mb-1margin-bottom: 0.25rem;
.bc-ml-0margin-left: 0;
.bc-ml-1margin-left: 0.25rem;
.bc-ml-automargin-left: auto;

Flex and Grid

Last modified:

Use Flexbox to solve layout problems where content determine item sizing.

See also the Grid system.

Shared Flex and Grid classes

  • .bc-helper-gap
    • Sets gap and exposes CSS Vars for row and columns.

Flexbox parent helper classes

ClassPurpose
.bc-flexDefines a flex container
.bc-flex--wrapAllow flex items will wrap onto multiple lines, from top to bottom
.bc-flex--rowEstablishes the direction laying out in horizontal rows
.bc-flex--colEstablishes the direction laying out in vertical columns
.bc-flex--align-flex-startItems are aligned at the start of the cross axis
.bc-flex--align-centerItems are aligned in the center of the cross axis
.bc-flex--align-flex-endItems are aligned at the end of the cross axis
.bc-flex--justify-flex-startItems are packed toward the start of the flex-direction
.bc-flex--justify-space-betweenItems are evenly distributed in the line; first item is on the start line, last item on the end line
.bc-flex--justify-centerItems are centered along the line
.bc-flex--justify-flex-endItems are packed toward the end of the flex-direction

Flexbox children helper classes

  • .bc-flex-1
    • ⚠️ Careful: This shorthand can set flex-shrink and flex-basis.

Padding

Last modified:

Padding helpers use base-4 spacing system to maintain a consistent layout. The helpers cover the most common set of sizes we need for custom paddings.

Note the spacing units aren’t linearly-stepped.

For any padding larger than supported sizes, please continue to use the bc-space()SASS function.

Padding naming convention

Side (optional)Definition
ttop
rright
bbottom
lleft
xhorizontal (right and left)
yvertical (top and bottom)
SizePixelRem
000
14px0.25rem
28px0.5rem
316px1rem
420px1.25rem
524px1.5rem
632px2rem
740px2.5rem
848px3rem

Padding on all sides

Padding classDefinition
.bc-p-0padding: 0;
.bc-p-1padding: 0.25rem;

Padding on horizontal sides

Padding classDefinition
.bc-px-0padding-right: 0; padding-left: 0;
.bc-px-1padding-right: 0.25rem; padding-left: 0.25rem;

Padding on vertical sides

Padding classDefinition
.bc-py-0padding-top: 0; padding-bottom: 0;
.bc-py-1padding-top: 0.25rem; padding-bottom: 0.25rem;

Padding on one side

Padding classDefinition
.bc-pt-0padding-top: 0;
.bc-pt-1padding-top: 0.25rem;
.bc-pr-0padding-right: 0;
.bc-pr-1padding-right: 0.25rem;
.bc-pb-0padding-bottom: 0;
.bc-pb-1padding-bottom: 0.25rem;
.bc-pl-0padding-left: 0;
.bc-pl-1padding-left: 0.25rem;