Skip to content
Back to search

canvas-kit

Development kits to implement UI following the Workday Sana Canvas Design System (https://design.workday.com/design-system). See our Component Storybook -

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/workday--canvas-kit/badge.svg)](/listings/workday--canvas-kit)

HTML

<a href="/listings/workday--canvas-kit"><img src="/api/listings/workday--canvas-kit/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

React

**Dependency Version Support**

The following are supported versions of dependencies.

- React: >=17.0 - Typescript: >=5.0 (optional) - Emotion: ^11.7.0

**Installation**

To get started using Canvas kit React first add or install the module to your existing React project

yarn add @workday/canvas-kit-react @workday/canvas-tokens-web

or

npm install @workday/canvas-kit-react @workday/canvas-tokens-web

**Fonts**

Canvas Kit doesn't include fonts by default. See our [Fonts guide](https://workday.github.io/canvas-kit/?path=/docs/guides-fonts--docs) for setup instructions, including which font package to use depending on whether your application has the Sana Canvas theme enabled.

**Usage**

Update your root `index.js` file to import Canvas Kit's design tokens.

import {createRoot} from 'react-dom/client';
import {injectGlobal} from '@emotion/css';
import {system} from '@workday/canvas-tokens-web';
import {cssVar} from '@workday/canvas-kit-styling';

import '@workday/canvas-tokens-web/css/base/_variables.css';
import '@workday/canvas-tokens-web/css/brand/_variables.css';
import '@workday/canvas-tokens-web/css/component/_variables.css';
import '@workday/canvas-tokens-web/css/system/_variables.css';
// The Sana variables import is needed if you're using the Sana Canvas theme, imported after
// system so its rules win the cascade tie over system's unscoped `:root` rules when set on <html>.
import '@workday/canvas-tokens-web/css/sana/_variables.css';

import {App} from './App';

injectGlobal({
  'html, body': {
    fontFamily: cssVar(system.fontFamily.default),
    margin: 0,
    minHeight: '100vh',
  },
  '#root, #root < div': {
    minHeight: '100vh',
    ...system.type.body.sm,
  },
});

const container = document.getElementById('root')!;
const root = createRoot(container);
root.render(<App />);

Set `data-theme="sana-canvas"` on `<html>` in your `index.html`:

<html lang="en" data-theme="sana-canvas"></html>

Then in your `App.js` you can wrap your application with `CanvasProvider`.

import {CanvasProvider} from '@workday/canvas-kit-react/common';

export const App = () => {
  return (
    <CanvasProvider>
      <main>
        <p>Get Started With Canvas Kit</p>
      </main>
    </CanvasProvider>
  );
};

If you cannot control `<html>` (embedded apps, microfrontends), pass `sanaCanvasProviderTheme` instead so menus, selects, and other popups still get Sana brand variables:

import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';

<CanvasProvider theme={sanaCanvasProviderTheme}>
  <App />
</CanvasProvider>

> **Note:** Don't use the `CanvasProvider` to theme, instead use our CSS tokens from > `@workday/canvas-tokens-web`. For more information, view our > [Token docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs). > Theming should be global.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 226 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Workday Canvas Kit
  2. This project provides a set of components for the Workday Canvas Design System that can be used to
  3. implement user experiences consistent with
  4. [Workday's design principles](https://canvas.workdaydesign.com/).
  5. <a href="./LICENSE">
  6. <img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Workday Canvas Kit is released under the Apache-2.0 license" />
  7. </a>
  8. <a href="https://lerna.js.org">
  9. <img src="https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg" alt="Maintained with Lerna" />
  10. </a>
  11. <a href="https://github.com/Workday/canvas-kit/actions/workflows/release.yml">
  12. <img alt="Release" src="https://github.com/Workday/canvas-kit/actions/workflows/release.yml/badge.svg">
  13. </a>
  14. <a href="./modules/docs/mdx/CONTRIBUTING.mdx">
  15. <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome" />
  16. </a>
  17. ---
  18. ## Getting Started
  19. ### React
  20. **Dependency Version Support**
  21. The following are supported versions of dependencies.
  22. - React: >=17.0
  23. - Typescript: >=5.0 (optional)
  24. - Emotion: ^11.7.0
  25. **Installation**
  26. To get started using Canvas kit React first add or install the module to your existing React project
  27. ```sh
  28. yarn add @workday/canvas-kit-react @workday/canvas-tokens-web
  29. ```
  30. or
  31. ```sh
  32. npm install @workday/canvas-kit-react @workday/canvas-tokens-web
  33. ```
  34. **Fonts**
  35. Canvas Kit doesn't include fonts by default. See our
  36. [Fonts guide](https://workday.github.io/canvas-kit/?path=/docs/guides-fonts--docs) for setup
  37. instructions, including which font package to use depending on whether your application has the Sana
  38. Canvas theme enabled.
  39. **Usage**
  40. Update your root `index.js` file to import Canvas Kit's design tokens.
  41. ```jsx
  42. import {createRoot} from 'react-dom/client';
  43. import {injectGlobal} from '@emotion/css';
  44. import {system} from '@workday/canvas-tokens-web';
  45. import {cssVar} from '@workday/canvas-kit-styling';
  46. import '@workday/canvas-tokens-web/css/base/_variables.css';
  47. import '@workday/canvas-tokens-web/css/brand/_variables.css';
  48. import '@workday/canvas-tokens-web/css/component/_variables.css';
  49. import '@workday/canvas-tokens-web/css/system/_variables.css';
  50. // The Sana variables import is needed if you're using the Sana Canvas theme, imported after
  51. // system so its rules win the cascade tie over system's unscoped `:root` rules when set on <html>.
  52. import '@workday/canvas-tokens-web/css/sana/_variables.css';
  53. import {App} from './App';
  54. injectGlobal({
  55. 'html, body': {
  56. fontFamily: cssVar(system.fontFamily.default),
  57. margin: 0,
  58. minHeight: '100vh',
  59. },
  60. '#root, #root < div': {
  61. minHeight: '100vh',
  62. ...system.type.body.sm,
  63. },
  64. });
  65. const container = document.getElementById('root')!;
  66. const root = createRoot(container);
  67. root.render(<App />);
  68. ```
  69. Set `data-theme="sana-canvas"` on `<html>` in your `index.html`:
  70. ```html
  71. <html lang="en" data-theme="sana-canvas"></html>
  72. ```
  73. Then in your `App.js` you can wrap your application with `CanvasProvider`.
  74. ```jsx
  75. import {CanvasProvider} from '@workday/canvas-kit-react/common';
  76. export const App = () => {
  77. return (
  78. <CanvasProvider>
  79. <main>
  80. <p>Get Started With Canvas Kit</p>
  81. </main>
  82. </CanvasProvider>
  83. );
  84. };
  85. ```
  86. If you cannot control `<html>` (embedded apps, microfrontends), pass `sanaCanvasProviderTheme`
  87. instead so menus, selects, and other popups still get Sana brand variables:
  88. ```jsx
  89. import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';
  90. <CanvasProvider theme={sanaCanvasProviderTheme}>
  91. <App />
  92. </CanvasProvider>
  93. ```
  94. > **Note:** Don't use the `CanvasProvider` to theme, instead use our CSS tokens from
  95. > `@workday/canvas-tokens-web`. For more information, view our
  96. > [Token docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
  97. > Theming should be global.
  98. ## Reporting a Bug
  99. If you spot a bug, inconsistency, or typo, please
  100. [open a bug issue](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md).
  101. Better yet, submit a pull request to address it.
  102. ## Feature Requests
  103. If you have an idea, we would love to hear about it. The best way to suggest a feature is to
  104. [open a feature issue](https://github.com/Workday/canvas-kit/issues/new?labels=feature&template=feature.md).
  105. The Canvas Kit core team will take a look and discuss it with you.
  106. ## Contributing
  107. Want to contribute to Canvas Kit React? Please read our
  108. [contributing guidelines](https://workday.github.io/canvas-kit/?path=/docs/guides-contributing--docs)
  109. to find out more and how to get started.
  110. ## Maintaining
  111. If you're a Canvas Kit maintainer, please read our
  112. [maintaining docs](https://workday.github.io/canvas-kit/?path=/docs/guides-maintaining--docs) to
  113. learn more about our processes.
  114. ## Open Development
  115. All work on the Canvas Kit happens directly on [GitHub](https://github.com/Workday/canvas-kit). Both
  116. core team members and external contributors can send pull requests which go through the same review
  117. process. Any and all issues are public and available for discussion.
  118. ## Versioning
  119. Canvas Kit follows [semantic versioning](https://semver.org/) and is enforced automatically by
  120. [conventional commits](https://www.conventionalcommits.org/) (see
  121. ["Commit Message Format"](https://workday.github.io/canvas-kit/?path=/docs/guides-contributing--docs#commit-message-format)).
  122. Each module is independently versioned using [Lerna](https://github.com/lerna/lerna).
  123. ## Version Support
  124. At any given time, we support three major versions of Canvas Kit: previous, current, and next. Each
  125. of these has different levels of support.
  126. The previous major version is stable for production and will receive patch updates as needed, but
  127. there will be no new features added. Patch releases are automatically deployed upon merge by GitHub
  128. Actions.
  129. The current major version is also stable and receives new features and patch updates. Patch releases
  130. are automatically deployed upon merge by GitHub Actions, and minor releases are manually deployed at
  131. the end of each sprint.
  132. The next major version is typically an unstable environment and has major breaking changes. You are
  133. welcome to pull this version down for local development and experimentation, but we generally
  134. recommend against using it in production until the first stable version has been released.
  135. ## Developer Documentation
  136. - [Contributing](https://workday.github.io/canvas-kit/?path=/docs/guides-contributing--docs)
  137. - [Code of Conduct](https://workday.github.io/canvas-kit/?path=/docs/guides-contributing--docs#code-of-conduct)
  138. - Upgrade Guides:
  139. - [v4.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v4-0--docs)
  140. - [v5.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v5-0--docs)
  141. - [v6.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v6-0--docs)
  142. - [v7.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v7-0--docs)
  143. - [v8.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v8-0--docs)
  144. - [v9.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v9-0--docs)
  145. - [v10.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v10-0--docs)
  146. - [v11.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v11-0--docs)
  147. - [v12.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v12-0--docs)
  148. - [v13.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v13-0--docs)
  149. - [v14.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v14-0-overview--docs)
  150. - [v15.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v15-0-overview--docs)
  151. - [v16.0 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v16-0-overview--docs)
  152. - Code Style / Best Practices:
  153. - [API & Pattern Guidelines](https://workday.github.io/canvas-kit/?path=/docs/guides-api-pattern-guidelines--docs)
  154. - [Compound Components](https://workday.github.io/canvas-kit/?path=/docs/guides-compound-components--docs)
  155. - [Creating Compound Components](https://workday.github.io/canvas-kit/?path=/docs/guides-creating-compound-components--docs)
  156. - [Testing](https://workday.github.io/canvas-kit/?path=/docs/guides-testing--docs)
  157. - [Fonts](https://workday.github.io/canvas-kit/?path=/docs/guides-fonts--docs)
  158. ## License
  159. The Workday Canvas Kits are licensed under the Apache 2.0 License.
  160. ## Supported Browsers
  161. - Microsoft Edge: last 2 versions
  162. - Mozilla Firefox: last 2 versions
  163. - Google Chrome: last 2 versions
  164. - Apple Safari: last 2 versions
  165. - Opera: last 2 versions
  166. ## Thank you
  167. Visual Testing by [ChromaticQA](https://www.chromaticqa.com/)
  168. Builds by [Github Actions](https://docs.github.com/en/actions)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.