1.0.0-beta.1 • Published 8 months ago

@kyndryl-design-system/foundation v1.0.0-beta.1

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

Kyndryl Design System - Foundation

kyndryl-foundation

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/foundation -S

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

Import the root styles to your app's global styles

The method used (JS Import, SCSS @use, CSS @import, or <style> tag) will vary based on your framework/bundler, but the stylesheet can be found in node_modules at:

@kyndryl-design-system/foundation/scss/root.scss
// or
@kyndryl-design-system/foundation/css/root.css

Use CSS tokens/variables

You can make use of tokens/variables included in root.css such as --kyn-header-height to pad the body for the fixed position header, --kyn-spacing-gutter for the padding on your main container, or any of the color tokens. These are very bare-bones currently, and will need to be fleshed out later.

Start using components

See Storybook for the full components documentation.

Example: Component with Sub-components

This example imports the Header component AND all of it's subcomponents by targeting the index file.

import '@kyndryl-design-system/foundation/components/global/header';
<kyn-header>
  <kyn-header-nav>
    <kyn-header-link>Link</kyn-header-link>
  </kyn-header-nav>
</kyn-header>

Example: Single Component

This example imports the HeaderLink component by targeting the component file directly.

import '@kyndryl-design-system/foundation/components/global/header/headerLink';
<kyn-header-link>Link</kyn-header-link>

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.

1.0.0-beta.24

8 months ago

1.0.0-beta.23

8 months ago

1.0.0-beta.22

8 months ago

1.0.0-beta.21

9 months ago

1.0.0-beta.20

9 months ago

1.0.0-beta.19

9 months ago

1.0.0-beta.18

9 months ago

1.0.0-beta.17

9 months ago

1.0.0-beta.16

9 months ago

1.0.0-beta.15

9 months ago

1.0.0-beta.14

9 months ago

1.0.0-beta.13

9 months ago

1.0.0-beta.12

9 months ago

1.0.0-beta.11

9 months ago

1.0.0-beta.10

9 months ago

1.0.0-beta.9

9 months ago

1.0.0-beta.8

9 months ago

1.0.0-beta.7

9 months ago

1.0.0-beta.6

9 months ago

1.0.0-beta.5

9 months ago

1.0.0-beta.4

9 months ago

1.0.0-beta.3

9 months ago

1.0.0-beta.2

9 months ago

1.0.0-beta.1

9 months ago