Read the Contributing Guide here.
npm install @kyndryl-design-system/shidoka-foundation -S
The method used (SCSS @use, CSS @import, JS import, or <style> tag) will vary based on your framework/bundler. Some examples:
@use '@kyndryl-design-system/shidoka-foundation/scss/root.scss';
@import '@kyndryl-design-system/shidoka-foundation/css/root.css';
import '@kyndryl-design-system/shidoka-foundation/css/root.css';
You can make use of tokens/variables included in root.css such as --kd-header-height
to pad the body for the fixed position header, --kd-page-gutter
for the padding on your main container, or any of the color tokens.
See Storybook for the full components documentation.
This example imports a component AND all of it's subcomponents by targeting the index file.
import '@kyndryl-design-system/shidoka-foundation/components/example';
<kd-example>
<kd-example-sub></kd-example-sub>
</kd-example>
This example imports one specific component by targeting the component file directly.
import '@kyndryl-design-system/shidoka-foundation/components/example/example-sub';
<kd-example-sub></kd-example-sub>
React does not yet support automatic interop with Web Components. This means that React treats all props passed to Web Components as string attributes. It sounds like they are planning to release it eventually, and is now available behind an @experimental
flag. Until you've upgraded to a version of React that has support, you will need to use a library like @lit/react to use these components in React.
Some options for React wrapper libraries:
When using with an SSR framework like Next.js, you will encounter errors with code that only runs client-side, like window
references for example. This is because web components cannot render on the server. Here is an article that provides some methods to work around this: Using Non-SSR Friendly Components with Next.js and How to entirely disable server-side rendering in next.js v13?. Basically, they need their rendering deferred to only happen on the client-side.
Here is some additional information about why SSR does not work for web components, and some potential polyfills/solutions to enable server rendering: https://lit.dev/docs/ssr/overview/