1.0.0-beta.7 • Published 2 months ago

@kyndryl-design-system/shidoka-content v1.0.0-beta.7

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

Shidoka Web Components for Content

shidoka-content

Contributing to this project

Read the Contributing Guide here.

Using this library in another project

Install the package

# stable/main
npm install @kyndryl-design-system/shidoka-content @kyndryl-design-system/shidoka-foundation -S

# beta (use until first stable release)
npm install @kyndryl-design-system/shidoka-content@beta @kyndryl-design-system/shidoka-foundation@beta -S
# when using beta, lock the version, as breaking changes can happen at any time

Import the root stylesheet to your app's global styles

The method used (SCSS @use, CSS @import, JS import, or <style> tag) will vary based on your framework/bundler. Some examples:

SCSS

@use '~@kyndryl-design-system/shidoka-foundation/scss/root.scss';

CSS

@import '@kyndryl-design-system/shidoka-foundation/css/root.css';

JS

import '@kyndryl-design-system/shidoka-foundation/css/root.css';

Use CSS tokens/variables

You can make use of tokens/variables included in root.css such as any of the color tokens.

Start using components

See Storybook for the full components documentation.

Example

import '@kyndryl-design-system/shidoka-content/components/alternatingFeatureWithImage';
<kd-alternating-feature-with-image>
  <!-- content here -->
</kd-alternating-feature-with-image>

React usage

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 with React 19, 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 reactify-wc to use these components in React.

Some options for React wrapper libraries:

  1. reactify-wc
  2. wc-react
  3. @lit-labs/react

Server-Side Rendering (SSR)

When using with an SSR framework like Next.js, you may encounter errors with code that only runs client-side, like window references for example. Here is an article that provides some methods to work around this: Using Non-SSR Friendly Components with Next.js. Basically, for components that make use of something like window, they need their rendering deferred to only happen on the client-side.