Contextual
The contextual module provides you with simple tags, marks and highlights for your pages, allowing you to easily emphasize parts of your text. The contextual alerts aim to replace the commonly used modal dialog design paradigm with a more modern one. HTML5 elements and simple rules are used in order to make important messages and pieces of content stand out easily.
All examples showcased refer to the mini-default flavor, some class names and styles might differ based on the flavor you're using.
Quick overview
Almost every piece of content present on the web has some sort of content that needs highlighting in one way or another. The contextual module provides you with simple semantic text highlighting that utilises the <mark>
HTML element. Apart from that, this module contains styles and definitions for a simple .alert
container, that you can use to show alerts on your websites and web apps. Alerts replace the traditional design paradigms of modals, messages and alerts by defining a simple, usable container that is also mobile friendly. Finally, a simple accessible .tooltip
implementation is included. All components in this module are fully accessible, so that's another thing not to worry about.
Quick start
To customize the contextual module, duplicate an existing flavor file (we suggest you use the mini-default.scss
flavor file) and use this page's variable tables and mixins as a reference to change only the values you need. Remember to compile your flavor file (not the module's partial file) using a Sass preprocessor (we highly recommend using sass-autocompile if you are working with Atom).
Text highlighting
The contextual module's styling of <mark>
elements is highly customizable.
Variable | Type | Description | Sample value |
---|---|---|---|
$mark-back-color | Color | Background color for <mark> elements | #0277bd |
$mark-fore-color | Color | Text color for <mark> elements | #fafafa |
$mark-font-size | Font size | Font size for <mark> elements | 95% |
$mark-line-height | Line height | Line height for <mark> elements | 1 |
$mark-border-style | Border | Border style for <mark> elements | 1px solid #0277bd |
$mark-border-radius | Border radius | Border radius for <mark> elements | 2px |
$mark-padding | Padding | Padding for <mark> elements | 2px 4px |
$mark-margin | Margin | Margin for <mark> elements | 2px |
$mark-box-shadow | Box shadow | Box shadow for <mark> elements | 0 1px 3px rgba(0,0,0, 0.1) |
$mark-inline-block-name | String | Class name for inline block <mark> elements | 'inline-block' |
Alerts
The contextual module's contains custom classes and styles for defining alerts.
Variable | Type | Description | Sample value |
---|---|---|---|
$alert-name | String | Class name for alert components | 'alert' |
$alert-back-color | Color | Background color for alert components | #eeeeee |
$alert-fore-color | Color | Text color for alert components | $fore-color |
$alert-border-style | Border | Border style for alert components | 1px solid #bdbdbd |
$alert-border-radius | Border radius | Border radius for alert components | 2px |
$alert-padding | Padding | Padding for alert components | 12px 16px |
$alert-margin | Margin | Margin for alert components | 6px |
$alert-box-shadow | Box shadow | Box shadow for alert components | 0 1px 3px rgba(0,0,0, 0.1) |
$alert-include-animated | Logical | Enables animated alert components1 | true |
$alert-animated-class | String | Class name for animated alert components1 | 'animated' |
Notes:
- The value of
$alert-animated-class
will only be used if$alert-include-animated
is set totrue
.
Tooltips
The contextual module's contains a flag to enable or disable tooltips, custom classes for creating them and other variables for style customization.
Variable | Type | Description | Sample value |
---|---|---|---|
$include-tooltip | Logical | Enables tooltip components1 | true |
$tooltip-name | String | Class name for tooltip components1 | 'tooltip' |
$tooltip-back-color | Color | Background color for tooltip components1 | $fore-color |
$tooltip-fore-color | Color | Text color for tooltip components1 | #fafafa |
$tooltip-border-radius | Border radius | Border radius for tooltip components1 | 2px |
$tooltip-padding | Padding | Padding for tooltip components1 | 12px 16px |
$tooltip-tail-size | Position left | Left position for tooltip components's tail (calculated from value)1 | 6px |
$tooltip-box-shadow | Box shadow | Box shadow for tooltip components1 | 0 1px 3px rgba(0,0,0, 0.1) |
$tooltip-bottom-name | String | Class name for animated tooltip components1 | 'bottom' |
Notes:
- The values used in the tooltip components will only be used if
$include-tooltip
is set totrue
.
Text highlighting mixins
The contextual module contains a couple of mixins for adding custom styles to <mark>
elements (color and style variants).
Mixin | Description |
---|---|
make-mark-alt-color ($mark-alt-name, $mark-alt-back-color, $mark-alt-fore-color) | Creates a new <mark> color variant using the specified values. |
make-mark-alt-style ($mark-alt-name, $mark-alt-border-style, $mark-alt-border-radius, $mark-alt-padding, $mark-alt-font-size, $mark-alt-line-height, $mark-alt-box-shadow) | Creates a new <mark> style variant using the specified values. |
Parameter | Type | Description | Sample value |
---|---|---|---|
$mark-alt-name | String | Class name for the <mark> color variant | 'secondary' |
$mark-alt-back-color | Color | Background color for the <mark> color variant | #e53935 |
$mark-alt-fore-color | Color | (Optional) Text color for the <mark> color variant | #fafafa |
Sample usage
@include make-mark-alt-color ('secondary', #e53935, #fafafa);
Parameter | Type | Description | Sample value |
---|---|---|---|
$mark-alt-name | String | Class name for the <mark> style variant | 'tag' |
$mark-alt-border-style | Border | Border style for the <mark> style variant | 1px solid #0277bd |
$mark-alt-border-radius | Border radius | Border radius for the <mark> style variant | 200px |
$mark-alt-padding | Padding | Padding for the <mark> style variant | 4px 8px |
$mark-alt-font-size | Font size | Font size for the <mark> style variant | 95% |
$mark-alt-line-height | Line height | Line height for the <mark> style variant | 1 |
$mark-alt-box-shadow | Margin | Box shadow for the <mark> style variant | 0 1px 3px rgba(0,0,0, 0.1) |
Sample usage
@include make-mark-alt-style ('tag', 1px solid #0277bd, 200px, 4px 8px, 95%, 1, 0 1px 3px rgba(0,0,0, 0.1));
Alert mixins
The contextual module contains a couple of mixins for adding custom styles to alerts (color and style variants).
Mixin | Description |
---|---|
make-alert-alt-color ($alert-alt-name, $alert-alt-back-color, $alert-alt-fore-color) | Creates a new alert color variant using the specified values. |
make-alert-alt-style ($alert-alt-name, $alert-alt-border-style, $alert-alt-border-radius, $alert-alt-padding, $alert-alt-margin, $alert-alt-box-shadow) | Creates a new alert style variant using the specified values. |
Parameter | Type | Description | Sample value |
---|---|---|---|
$alert-alt-name | String | Class name for the alert color variant | 'urgent' |
$alert-alt-back-color | Color | Background color for the alert color variant | #ffca28 |
$alert-alt-fore-color | Color | (Optional) Text color for the alert color variant | #212121 |
Sample usage
@include make-alert-alt-color ('urgent', #ffca28, #212121);
Parameter | Type | Description | Sample value |
---|---|---|---|
$alert-alt-name | String | Class name for the alert style variant | 'urgent' |
$alert-alt-border-style | Border | Border style for the alert style variant | 1px solid #ff8f00 |
$alert-alt-border-radius | Border radius | Border radius for the alert style variant | 2px |
$alert-alt-padding | Padding | Padding for the alert style variant | 12px 16px |
$alert-alt-margin | Margin | Margin for the alert style variant | 6px |
$alert-alt-box-shadow | Margin | Box shadow for the alert style variant | 0 1px 3px rgba(0,0,0, 0.1) |
Sample usage
@include make-alert-alt-style ('urgent', 1px solid #ff8f00, 2px, 12px 16px, 6px, 6px, 0 1px 3px rgba(0,0,0, 0.1));
Tooltip mixins
The contextual module contains a couple of mixins for adding custom styles to tooltips (color and style variants).
Mixin | Description |
---|---|
make-tooltip-alt-color ($tooltip-alt-name, $tooltip-alt-back-color, $tooltip-alt-fore-color) | Creates a new tooltip color variant using the specified values. |
make-tooltip-alt-style ($tooltip-alt-name, $tooltip-alt-tail-size, $tooltip-alt-border-radius, $tooltip-alt-padding, $tooltip-alt-box-shadow) | Creates a new tooltip style variant using the specified values. |
Parameter | Type | Description | Sample value |
---|---|---|---|
$tooltip-alt-name | String | Class name for the tooltip color variant | 'primary' |
$tooltip-alt-back-color | Color | Background color for the tooltip color variant | #0277bd |
$tooltip-alt-fore-color | Color | (Optional) Text color for the tooltip color variant | #fafafa |
Sample usage
@include make-tooltip-alt-color ('primary', #0277bd, #fafafa);
Parameter | Type | Description | Sample value |
---|---|---|---|
$tooltip-alt-name | String | Class name for the tooltip style variant | 'large' |
$tooltip-alt-tail-size | Position left | Left position for tooltip style variant's tail (calculated from value) | 8px |
$tooltip-alt-border-radius | Border radius | Border radius for the tooltip style variant | 4px |
$tooltip-alt-padding | Padding | Padding for the tooltip style variant | 15px 20px |
$tooltip-alt-box-shadow | Margin | Box shadow for the tooltip style variant | 0 1px 3px rgba(0,0,0, 0.1) |
Sample usage
@include make-tooltip-alt-style ('large', 8px, 4px, 15px 20px, 0 1px 3px rgba(0,0,0, 0.1));
If you want to learn more about customizing mini.css, go back to the customization page or choose a module from the top menu to see its documentation.