Get started
Installation
Install the package, load the styles once, import the elements you use.
Installation
npm install claymorph-ui @ui-sdk/web @ui-sdk/core
npm install claymorph-ui @ui-sdk/web @ui-sdk/core
Then import claymorph-ui/clay.css once and each element you use, like claymorph-ui/button.
@ui-sdk/web and @ui-sdk/core are peer dependencies, so your app and Clay share one copy. Load ui-sdk's styles and Clay's once, then import each element you use.
import "@ui-sdk/core/web.css"
import "claymorph-ui/clay.css"
import "claymorph-ui/button"
import "claymorph-ui/select"
import "@ui-sdk/core/web.css"
import "claymorph-ui/clay.css"
import "claymorph-ui/button"
import "claymorph-ui/select"
Every element has its own entry, named for its tag without clay-: claymorph-ui/button, claymorph-ui/select, claymorph-ui/toast. Each one registers its element and the ui-sdk parts it wraps, so <ui-button> and friends are defined too, and your bundler leaves out the elements you don't import. claymorph-ui/toast also exports toast and createToaster.
// Or register every element at once.
import "claymorph-ui"
// Or register every element at once.
import "claymorph-ui"
<clay-button color="teal">
<ui-button><button>Get started</button></ui-button>
</clay-button>
<clay-button color="teal">
<ui-button><button>Get started</button></ui-button>
</clay-button>
Types ship with the package. Each entry adds its element to HTMLElementTagNameMap, so document.querySelector("clay-select") is typed as ClaySelect.