Variables

Variables are available in several formats including SASS, CSS Vars, TypeScript, JavaScript, and JSON.

Variable Value
$transition 150ms ease-in-out
$easing-function cubic-bezier(0.215,0.44,0.42,0.88)
$transition-short 150ms ease-in-out
$transition-medium 300ms cubic-bezier(0.215,0.44,0.42,0.88)
$transition-long 500ms cubic-bezier(0.215,0.44,0.42,0.88)
$viewport-small 480px
$viewport-medium 860px
$viewport-large 1440px
$baseline-ratio 1.5
$baseline 1.5rem
$ratio 1.414
$medium-ratio 1.33
$small-ratio 1.25
$body-size 1rem
$small-size .85rem
$indent 1em
$avenir-tracking 0
$avenir-family 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif
$code-tracking 0
$code-family 'Consolas','Andale Mono','Lucida Console','Monaco',monospace
$shadow-1 0 0 8px 0 rgba(0,0,0,0.08)
$shadow-1--hover 0 0 16px 0 rgba(0,0,0,0.08)
$shadow-1--press 0 0 8px 0 rgba(0,0,0,0.16)
$shadow-2 0 0 16px 0 rgba(0,0,0,0.16)
$shadow-2--hover 0 0 32px 0 rgba(0,0,0,0.16)
$shadow-2--press 0 0 16px 0 rgba(0,0,0,0.32)
$border-radius 3px
$spacing-0 0
$spacing-1 .25rem
$spacing-2 .5rem
$spacing-3 .75rem
$spacing-4 1rem
$spacing-5 1.25rem
$spacing-6 1.5rem
$spacing-8 2rem
$spacing-10 2.5rem
$spacing-12 3rem
$spacing-16 4rem
$spacing-20 5rem
$spacing-24 6rem
$spacing-32 8rem
$spacing-40 10rem
$spacing-48 12rem
$spacing-56 14rem
$spacing-64 16rem
$spacing-px 1px

Shadow Mixins

shadow ($level, $state)

Add a shadow to an element from one of calcite's two shadow levels

Parameters

Name Description Type Default value
$level levels above the base (1|2) number 1
$state Optionally define the UI state of element ("hover"|"press") string none

Type Mixins

avenir-light ()

Render text in a light weight (300)

avenir-light-italic ()

Render text in an italic light weight (300)

avenir-regular ()

Render text in a regular weight (400);

avenir-italic ()

Render text in italics

avenir-bold ()

Render text in a bold weight (700)

avenir-bold-italic ()

Render text in italic bold

code-face ()

Apply styles for monospace code font. Updates font-family, tracking, and style

code-italic ()

Apply styles for italic monospace code font.

tracking ($n)

Space characters in a word horizontally

Parameters

Name Description Type Default value
$n positive or negative number (0 is normal) number none

Example

@include tracking(100);

word-spacing ($n)

Add space between words

Parameters

Name Description Type Default value
$n positive or negative number (0 is normal) number none

Example

word-spacing mixin
@include word-spacing(200); // add lots of space between each word

leading ($n)

Space lines of text vertically

Parameters

Name Description Type Default value
$n positive number (1 is normal) number none

Example

@include leading(2); // twice as much vertical space

text-inline ()

Display element inline

text-center ()

align text in the center

text-left ()

align text to the left (right in rtl)

text-right ()

align text to the right (left in rtl)

text-light ()

lower the opacity of text to make it more subtle (be careful to retain accessible contrast ratio)

text-ellipsis ()

add overflow-ellipsis to the element when ther eis more text than will fit on one line

text-color ($value)

Apply a color to text

Parameters

Name Description Type Default value
$value any valid CSS color value or variable string none

Example

@include color($blue);

font-size ($n, $line-height)

Apply responsive text sizing to an element. Use only whole numbers to maintain proper typographic scale.

Parameters

Name Description Type Default value
$n negative or positive number (0 is default size) number none
$line-height line-height you'd like to use (default chosen based on size) number none

Example

@include font-size(-1); // one step smaller on the scale
@include font-size(2, 1.25); // two steps larger on the scale, 1.25 line-height

Utilities Mixins

clearfix ()

Adds a clearfix to the item via a psuedo element.

rtl ()

Used for overriding styles in right to left languages. Styles will be applied when html element is in right to left mode.

Example

.myClass { 
  margin-left: 1rem;
  @include rtl {
    margin-left: 0;
    margin-right: 1rem;
  }
}

left ()

Floats an element to the left. In right-to-left documents, will automatically switch to float right.

right ()

Floats an element to the right. In right-to-left documents, will automatically switch to float left.

visually-hidden ()

Hide an element visually, but leave it available to screen readers.

visually-hidden-focusable ()

Hide an element visually, but allow it to be focused (useful for things like skip-to-content links).

Animation Mixins

animation ($animations...)

Generate a prefixed version of the animation property

Parameters

Name Description Type Default value
$animations... one or more (comma separated) animations to be prefixed string none

animation-name ($names...)

Generate a prefixed version of the animation-name property

Parameters

Name Description Type Default value
$names... one or more (comma separated) names to be prefixed string none

animation-duration ($times...)

Generate a prefixed version of the animation-duration property

Parameters

Name Description Type Default value
$times... one or more (comma separated) times to be prefixed string none

animation-timing-function ($motions...)

Generate a prefixed version of the animation-timing-function property

Parameters

Name Description Type Default value
$motions... one or more (comma separated) motions to be prefixed string none

animation-iteration-count ($values...)

Generate a prefixed version of the animation-iteration-count property

Parameters

Name Description Type Default value
$values... one or more (comma separated) values to be prefixed string none

animation-direction ($directions...)

Generate a prefixed version of the animation-direction property

Parameters

Name Description Type Default value
$directions... one or more (comma separated) directions to be prefixed string none

animation-play-state ($states...)

Generate a prefixed version of the animation-play-state property

Parameters

Name Description Type Default value
$states... one or more (comma separated) states to be prefixed string none

animation-delay ($times...)

Generate a prefixed version of the animation-delay property

Parameters

Name Description Type Default value
$times... one or more (comma separated) times to be prefixed string none

animation-fill-mode ($modes...)

Generate a prefixed version of the animation-fill-mode property

Parameters

Name Description Type Default value
$modes... one or more (comma separated) modes to be prefixed string none

keyframes ($name)

Generate keyframes with browser prefixes

Parameters

Name Description Type Default value
$name name of resulting keyframes string none

Example

creates keyframes named out-up
@include keyframes(out-up) {
  0%   { transform: translate3d(0, 0, 0);}
  100% { transform: translate3d(0, 100%, 0); }
}

fade-in ($duration, $name)

Apply the fade-in animation to an element

Parameters

Name Description Type Default value
$duration length of the fade in (optional) time .75s
$name name of keyframes reference (optional) string fade-in

fade-out ($duration, $name)

Apply the fade-out animation

Parameters

Name Description Type Default value
$duration duration of the animation (optional) time .75s
$name name of the referenced keyframes (optional) string fade-out

in-up ($duration, $name)

Apply the in-up animation

Parameters

Name Description Type Default value
$duration duration of the animation (optional) time 0.5s
$name name of the referenced keyframes (optional) string in-up

in-down ($duration, $name)

Apply the in-down animation

Parameters

Name Description Type Default value
$duration duration of the animation (optional) time 0.5s
$name name of the referenced keyframes (optional) string in-down

out-up ($duration, $name)

Apply the out-up animation

Parameters

Name Description Type Default value
$duration duration of the animation (optional) time 0.5s
$name name of the referenced keyframes (optional) string out-up

out-down ($duration, $name)

Apply the out-down animation

Parameters

Name Description Type Default value
$duration duration of the animation (optional) time 0.5s
$name name of the referenced keyframes (optional) string out-down

fade-in-keyframes ($name)

Generate keyframes for fade-in

Parameters

Name Description Type Default value
$name name of the generated keyframes (optional) string fade-in

fade-out-keyframes ($name)

Generate keyframes for fade-out

Parameters

Name Description Type Default value
$name name of the generated keyframes (optional) string fade-out

in-up-keyframes ($name)

Generate keyframes for in-up

Parameters

Name Description Type Default value
$name name of the generated keyframes (optional) string in-up

in-down-keyframes ($name)

Generate keyframes for in-down

Parameters

Name Description Type Default value
$name name of the generated keyframes (optional) string in-down

out-up-keyframes ($name)

Generate keyframes for out-up

Parameters

Name Description Type Default value
$name name of the generated keyframes (optional) string out-up

out-down-keyframes ($name)

Generate keyframes for out-down

Parameters

Name Description Type Default value
$name name of the generated keyframes (optional) string out-down

Responsive Mixins

respond-to ($max, $min, $type)

Apply styles to an element at certain screen sizes

Parameters

Name Description Type Default value
$max css measurement (px, rem, etc) for largest size around string none
$min css measurement (px, rem, etc) for smallest size allowed (optional) string none
$type media type (optional) string screen

Example

using only the max-width argument
@include respond-to($viewport-small) {
  padding: 1rem; // element will have padding up to the small viewport
}
using both the min and max
@include respond-to($viewport-small, $viewport-large) {
  padding: 1rem; // applied from small to large
}