This module has helpers for working with text and helps to create colors and different sizes of text.

Usage #

Superkube has several classes for specifying text size.








<p class="text-mega">Mega</p>
<p class="text-huge">Huge</p>
<p class="text-large">Large</p>
<p class="text-medium">Medium</p>
<p class="text-small">Small</p>
<p class="text-micro">Micro</p>

Size #

By default, the size of text is set in $scales. The first value is the font size, the second value is the line-height parameter.

// =Scales
$scales: (
    type: (
        text: (
            mega: 24px 1.5,
            huge: 20px 1.5,
            large: 18px 1.5,
            default: 16px 1.5,
            medium: 14px 1.5,
            small: 13px 1.5,
            micro: 12px 1.5

You can change the size of text or add your own size by extending $scales. See also how to work with text size scales for modules.

// =Scales
$scales: map-extend($scales, (
    type: (
        text: (
            giga: 40px 1.5,
            huge: 21px 1.5

In the example above, the text-huge gets a new font size of 21px and a new text size exa is added.

Superkube will automatically create a text-giga class specified in $scales.

<p class="text-giga">...</p>

Responsive #

If you need to change the text sizes for different screens, extend the type-sm, type-md, type-lg groups in $scales.

// =Scales
$scales: map-extend($scales, (
    type-sm: (
        text: (
            mega: 22px 1.5
    type-lg: (
        text: (
            mega: 32px 1.3

In the example above, the mega text would be 22px on small screens and 32px on larger screens. Of course, you can specify text size behavior for all named text, not just for mega.

Color #

By default, text have several classes for specifying color.




Dark Mid





Light Mid

Light Muted

<p class="text-primary">Primary</p>
<p class="text-dark">Dark</p>
<p class="text-dark-mid">Dark Mid</p>
<p class="text-muted">Muted</p>
<p class="text-success">Success</p>
<p class="text-error">Error</p>
<p class="text-light">Light</p>
<p class="text-light-mid">Light Mid</p>
<p class="text-light-muted">Light Muted</p>

You can change the color of text or add your own color by extending $colors map.

// =Colors
$colors: map-extend($colors, (
    text: (
        muted: var(--palette-black-40),
        important: var(--palette-red-base)

In the example above, the muted text will become more muted. Also, the new important text color will be added.

Text important

<p class="text-large text-important">...</p>

Gradient #

The text can have a gradient color. You can add a gradient by extending $colors map.

// =Colors
$colors: map-extend($colors, (
    text: (
        gradient-primary: linear-gradient(90deg, var(--palette-green-base), var(--palette-blue-base))

Now you have a gradient modifier for the text.

Text Gradient

<p class="text-large text-gradient-primary">...</p>

Style #

In some cases it may be needed to change the style of text. To do this simply specify additional text properties in your SCSS.

.text-small {
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.01em;

Helpers #

Text have several helper classes that change the font-weight.

Text Semibold

Text Strong

<p class="text-semibold">...</p>
<p class="text-strong">...</p>

That's what each of them means:

  • semibold — semibold weight with font-weight: 600;
  • strong — bold weight with font-weight: bold.

Note: the font weight classes will not work if they are not in the font you are using in your project.

In addition to the helper classes for the font weight, there are a few more.

Text Italic

Text Caps

Text Mono

Text Nowrap

<p class="text-italic">...</p>
<p class="text-caps">...</p>
<p class="text-mono">...</p>
<p class="text-nowrap">...</p>

Variables #

Here are the CSS variables used in the module. Setting them allows you to change the appearance and parameters of the module.

--text-font-size: {value};
--text-line-height: {value};
--text-color: {value};