Motion
The Carbon motion package empowers consistent cadence and movement of elements across digital experiences.
Usage
The
@carbon/motion
@use '@carbon/motion';.selector {// Set `transition-timing-function` directly@include motion.motion(standard, productive);// Alternativelytransition: opacity motion.motion(standard, productive);// Or use a duration
API
Name | Type |
---|---|
| Duration |
| Duration |
| Duration |
| Duration |
| Duration |
| Duration |
| Map |
| Mixin |
| Mixin |
JavaScript
If you’re using
@carbon/motion
motion
// CommonJSconst { easings, motion } = require('@carbon/motion');
You can also include this as a JavaScript module:
// ESMimport { easings, motion } from '@carbon/motion';motion('standard', 'productive'); // Returns a string `cubic-bezier()` function
Configuration
You can configure parts of the
@carbon/motion
$prefix
@use '@carbon/motion' with ($prefix: 'custom-prefix');
For a full list of options that you can configure, check out the table below.
Option | Description | Default |
---|---|---|
| The prefix that is used in selectors, CSS Custom Properties, etc. |
|