Socket
Socket
Sign inDemoInstall

@workday/canvas-kit-css-core

Package Overview
Dependencies
2
Maintainers
6
Versions
1055
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @workday/canvas-kit-css-core

The core css for canvas-kit-css


Version published
Maintainers
6
Install size
591 kB
Created

Readme

Source

Canvas Kit Core

Canvas Kit Core contains values and base styles that are shared across the kit.

Mainenance Mode

Includes:

Installation

yarn add @workday/canvas-kit-css

or

yarn add @workday/canvas-kit-css-core

Add your node_modules directory to your SASS includePaths. You will then be able to import index.scss.

You may also import specific modules from /lib.

@import '~@workday/canvas-kit-css-core/index.scss';
@import '~@workday/canvas-kit-css-core/lib/colors.scss';

Colors

Workday Canvas color variables in weights from 100 - 600. Colors are in hex code format.

See lib/colors.scss for the full list of available colors.

$wdc-color-cinnamon-600: #a31c12;
$wdc-color-cinnamon-500: #de2e21;
$wdc-color-cinnamon-400: #ff5447;
$wdc-color-cinnamon-300: #ff867d;
$wdc-color-cinnamon-200: #fcc2bd;
$wdc-color-cinnamon-100: #ffeeed;

Colors
Cinnamon
Peach
Chili Mango
Cantaloupe
Sour Lemon
Juicy Pear
Kiwi
Green Apple
Watermelon
Jewel
Toothpaste
Blueberry
Plum
Berry Smoothie
Blackberry
Island Punch
Grape Soda
Pomegranate
Fruit Punch
Root Beer
Toasted Marshmallow
Coconut
Cappuccino
Soap
Licorice
French Vanilla
Black Pepper

Border Radius

Border Radius variables in t-shirt size format. Spacing values are in px format.

VariableSize
$wdc-border-radius-zero0
$wdc-border-radius-s2px
$wdc-border-radius-m4px
$wdc-border-radius-l8px
$wdc-border-radius-circle999px

Spacing

Spacing variables in t-shirt size format. Spacing values are in px format.

VariableSize
$wdc-spacing-xxxs4px
$wdc-spacing-xxs8px
$wdc-spacing-xs12px
$wdc-spacing-s16px
$wdc-spacing-m24px
$wdc-spacing-l32px
$wdc-spacing-xl40px
$wdc-spacing-xxl64px
$wdc-spacing-xxxl80px

Depth

Five levels of depth available in CSS classes and SASS mixins.

The CSS classes are implemented using the equivalent SASS mixin.

HTML

<div class="wdc-depth-1">
  <h4 class="wdc-type-h5">Depth 1</h4>
</div>

SCSS

.standardItem {
  @include wdc-depth-1();
}

Depth -1: Inset card depth
Class: .wdc-depth-inset
Mixin: wdc-depth-inset

Depth 1: Standard card depth
Class: .wdc-depth-1
Mixin: wdc-depth-1

Depth 2: Increased card depth on hover
Class: .wdc-depth-2
Mixin: wdc-depth-2

Depth 3: Active, Task Orch, Pop Ups, Async Notification
Class: .wdc-depth-3
Mixin: wdc-depth-3

Depth 4: Cards on white backgrounds, Menus, Prompt window
Class: .wdc-depth-4
Mixin: wdc-depth-4

Type

Fonts

To use the Canvas Kit font install and import the @workday/canvas-kit-css-fonts module. Note that this module sources fonts from the Workday CDN.

Hierarchy

Type styles are available as classes and mixins. Using the class is preferred. Use mixins to override CSS only if necessary,

Base Type
Applies base body and font styles. Any type styles must be descendants of .wdc-type for the Canvas fonts to be used.

<div class="wdc-type">
  <h1 class="wdc-type-h1">Header</h1>
  <p class="wdc-type-body">Body text</p>
</div>

If you don't want to wrap your type elements with .wdc-type, you may also use the wdc-type mixin to set the default styling. For preset defaults (i.e. all headers, body font, links, etc.), simply apply .wdc to your body tag or a similar wrapper.

body {
  @include wdc-type();
}

There are mixins provided so you can do this for all levels of the type hierarchy if you'd like:

p {
  @include wdc-type-body();
}
h1 {
  @include wdc-type-h1();
}
h2 {
  @include wdc-type-h2();
}
...

Headings
Modifies font size and weight.

<h1 class="wdc-type-h1">H1 Header</h1>
<h2 class="wdc-type-h2">H2 Header</h2>
<h3 class="wdc-type-h3">H3 Header</h3>
<h4 class="wdc-type-h4">H4 Header</h4>
<h5 class="wdc-type-h5">H5 Header</h5>

Body

<p class="wdc-type-body">Body text</p>
<p class="wdc-type-body-2">Smaller body text</p>

Small

<p class="wdc-type-small">Small text</p>

Variations

You can modify any of the type hierarchy with the below variations:

Label

<span class="wdc-type-variant-label">Label Text</span>

Button

<span class="wdc-type-variant-button">Button Text</span>

Caps

<span class="wdc-type-variant-caps">Caps Text</span>

Hint

<span class="wdc-type-variant-hint">Hint Text</span>

Error

<span class="wdc-type-variant-error">Error Text</span>

Link

<a href="#" class="wdc-type-variant-link">Link Text</a>

Mono

<span class="wdc-type-variant-mono">Mono Text</span>

Inverse

<button class="wdc-type-variant-inverse">White Text</button>

Accessibility

By default, browsers add an outline around focusable elements. This is great for keyboard accessibility but is not the best visual experience for users who don't need it. To provide the best visual experience for all users, canvas-kit-css-core uses what-input to prevent outlines on mouse events while showing outlines during keyboard navigation. To include what-input into your project please view the what-input github repository.

Canvas-kit-css-core includes an accessibility.scss file that will target specific what-input styles. The elements within canvas-kit-css will prevent browser outlines from being shown during mouse events by default. You can apply the class .wdc-a11y to body or any other element to implement the same functionality for all focusable elements within a given element.

If you want to control when the outlines are shown/hidden yourself, you can use the wdc-show-outlines() and wdc-hide-outlines() mixins.

Keywords

FAQs

Last updated on 20 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc