Shape
The shape is given by the border radius value we apply to certain UI elements for visual or functional reasons. Some common examples of elements that need rounded corners are cards, buttons and labels.
While we still support our old tokens, we’re migrating our documentation and usage guidance to reflect our new Tokens Web. It is not currently a requirement to update all your tokens to use v11, but we strongly encourage you to begin migrating as you can. If you're an engineer looking to migrate to our new tokens, we wrote a handy migration guidefor you.
View v10 Shape Token Docs.yarn add @workday/canvas-tokens-web
yarn add @workday/canvas-tokens-web
Usage Guidance
- We can define the shape of an element by applying a border radius value to it. The border-radius property defines the radius of the element's corners.
- Every Canvas elements presents a specific shape that responds to the use and/or characteristics of this element.
- Our Canvas shape token includes five values ranging from a zero border radius for a rectangular
shape with sharp corners to a
999px
border radius for a circular shape.
Canvas Shapes
Canvas Shape Tokens uses multipliers with a {base.unit}
of 0.25rem
.
Using our Shapes
When working with border-radius, there are certain things we need to consider:
Do
- Be intentional when applying border-radius values following the usage guidelines above.
- All corners should always have the same value applied to ensure the shape doesn’t get distorted.
Don’t
- Avoid combining border-radius values.
Web Examples
Javascript / Typescript
// styles.tsimport {system} from '@workday/canvas-tokens-web';const styles = {borderRadius: `var(${system.shape.x2})`,};
CSS
// styles.css.card {border-radius: var(--cnvs-sys-shape-x2);}
Sample | CSS Variable | JS Variable | Value | Calculated Value | Pixel Value |
---|---|---|---|---|---|
--cnvs-sys-shape-zero | system. | 0rem | 0px | ||
--cnvs-sys-shape-half | system. | 0rem | 0px | ||
--cnvs-sys-shape-x1 | system. | 0rem | 0px | ||
--cnvs-sys-shape-x2 | system. | 0rem | 0px | ||
--cnvs-sys-shape-round | system. | 0rem | 0px |
Can't Find What You Need?
Check out our FAQ section which may help you find the information you're looking for.
FAQ Section