Helper Classes

Helper Classes

Canvas ships a large set of utility (helper) classes on top of Bootstrap 5's own utilities. These cover colours, spacing, hover effects, transforms, text effects, and more. Below are the real, verified helper families from the template's sass/_utilities.scss.

Colour and Background

Class Purpose
bg-color Background using the theme primary colour.
bg-contrast-* Background using a contrast scale value.
border-color Border using the theme colour.
border-contrast-* Border from the contrast scale.
gradient-* Apply a preset gradient background.
gradient-text Clip a gradient to the text.
text-contrast-* Text colour from the contrast scale.
nobg Remove background.
<div class="bg-color text-white p-4">Primary background</div>
<h2 class="gradient-text">Gradient heading</h2>

Hover Effects (prefix h-)

Many utilities have a hover variant, prefixed with h-, that only applies on hover:

Class Purpose
h-bg-color Change background colour on hover.
h-text-color Change text colour on hover.
h-shadow, h-shadow-sm, h-shadow-lg Add a shadow on hover.
h-scale, h-scale-sm, h-scale-lg Scale up on hover.
h-translate-y, h-translate-x Shift on hover.
h-rotate-* Rotate on hover.
h-op-0 / h-op-1 Fade out / in on hover.
<a href="#" class="button h-scale-sm h-shadow-sm">Hover me</a>

Transforms

Class Purpose
scale, scale-sm, scale-lg Scale the element. scale-n* for scale-down.
rotate-*, rotate-0, rotate-n* Rotate (n = negative).
translate-x, translate-y Translate on an axis (with -lg, -sm, and -n negative variants).
transform-ts Add a transition to transforms.

Text Effects

Class Purpose
text-stroke Outlined (stroked) text. text-stroke-none removes it.
text-shadow-none Remove text shadow.
text-transform-none Disable text-transform.
text-fill-effect Fill effect on text.
gradient-underline Gradient underline.
ls-*, ls-n Letter-spacing (n = negative).
fw-medium, fw-semibold, fw-extralight Extra font weights beyond Bootstrap's.
font-primary, font-secondary, font-body Apply a theme font family.
<h1 class="text-stroke fw-extralight ls-1">Outlined Title</h1>

Layout and Sizing

Class Purpose
divcenter (via .center/mx-auto) Center a block element.
inline-block Force inline-block display.
overflow-visible Allow overflow.
min-vh, max-vh, vh Viewport-height sizing helpers.
mw-* Max-width helpers.
square, square-* Equal width/height boxes.
vertical-middle Vertical-align middle.
col-padding Padding tuned for grid columns.
content-wrap Standard content padding wrapper.

Transitions and Opacity

Class Purpose
all-ts Transition all properties.
op-ts, bg-ts, border-ts, text-ts, shadow-ts, transform-ts Scoped transitions for specific properties.
op-0, op-1 Opacity 0 / 1.

Images

Class Purpose
grayscale Desaturate an image. grayscale-out reverses on hover.
imagescale, imagescalein Zoom effects on images.
lazy Marks an image for lazy loading.
<img src="images/photo.jpg" class="grayscale grayscale-out" alt="">

Notes and Tips

  • These helpers layer on top of Bootstrap 5, so you can freely mix them with Bootstrap spacing (p-4, me-3), display (d-none d-lg-block), and flex utilities.
  • Hover variants (h-*) only take effect on hover, letting you define a resting state and a hover state without custom CSS.
  • Responsive suffixes exist on many helpers (-sm, -lg) to scope an effect to a breakpoint.
  • Prefer these utility classes over inline styles for consistency with the theme's design tokens (colours, fonts, and contrast scale).

Settings

SettingDescription
.no-stickyDisable Stickiness of the Header. Use it on the header tag.
.static-sticky>Disable Resizing when Headers turn Sticky. Use it on the header tag.
data-sticky-classUse a different Header Style when it gets Sticky. This will look something like this:

Example:
<header class="dark" data-sticky-class="not-dark">
You can use these classes: .dark, .not-dark, .semi-transparent.
if you use the .semi-transparent Class, then you'll also need to include the .transparent Class.
.not-darkThis is a Handy Class, if you want to use Mixins. Suppose, You want to use the Dark Header Style, but dont want the Dropdown Menus to be Dark too, then you can simply add this class to the Primary Menu and you are good to go.

Example:
<ul class="sub-menu-container not-dark">
data-sticky-offsetThis Attribute is used to Define after how many Pixels you want your Header to be Sticky.

Example:
<header data-sticky-offset="100">
This will make the Header Sticky after scrolling down 100px. You can also set full value if you want the Header to be Sticky after scrolling Full Screen.
Was this page helpful?