Installation
For ordinary HTML, download a complete example. It uses the public stylesheet and module directly.
Install the package for a project with a build step, or to host a pinned copy of the files yourself.
Install the package
Section titled “Install the package”<code><span class="line"><span style="color:var(--docs-code-tag)">npm</span><span style="color:var(--docs-code-string)"> install</span><span style="color:var(--docs-code-string)"> @0001-labs/design-system-1</span></span></code>
For interactive components, see the component catalogue and each component’s import/API documentation. The package is another distribution channel, and it may lag the current documentation release; check that a component exists in the installed version. CSS-only pages do not need that package or its JavaScript bundle.
Use it with a bundler
Section titled “Use it with a bundler”In a project with a bundler that handles CSS, import the stylesheet and the components once, at your entry point:
<code><span class="line"><span style="color:var(--docs-code-keyword)">import</span><span style="color:var(--docs-code-string)"> "@0001-labs/design-system-1/styles"</span><span style="color:var(--docs-code-ink)">;</span></span><span class="line"><span style="color:var(--docs-code-keyword)">import</span><span style="color:var(--docs-code-string)"> "@0001-labs/design-system-1"</span><span style="color:var(--docs-code-ink)">;</span></span></code>
The first line loads the foundations. The second registers every ds-* element and exports the shared modules, such as setThemeMode and setLanguage. Then write the elements in your markup:
<code><span class="line"><span style="color:var(--docs-code-ink)"><</span><span style="color:var(--docs-code-tag)">ds-button</span><span style="color:var(--docs-code-ink)">>Save</</span><span style="color:var(--docs-code-tag)">ds-button</span><span style="color:var(--docs-code-ink)">></span></span></code>
React apps use the same ds-* elements directly. Server-rendered apps register the components in the browser.
What the package holds
Section titled “What the package holds”| Path | What it is |
|---|---|
ds1.css and ds1.js | The stylesheet and component module to load in HTML. |
dist/ | The built bundle with Lit included, its JavaScript chunks and its types. |
ds1/ | The source: components, stylesheets and fonts. |
| Import | What it gives you |
|---|---|
@0001-labs/design-system-1 | The component modules, dist/index.js. |
@0001-labs/design-system-1/styles | The foundations, ds1/1-root/one.css. |
@0001-labs/design-system-1/ds1/* | Any source file. |
@0001-labs/design-system-1/dist/* | Any built file. |
Hosting the files yourself
Section titled “Hosting the files yourself”The public ds1.css and ds1.js URLs follow the current documentation release. For a pinned or offline copy, host the package’s files on your own site:
Copy ds1.css and ds1.js beside the package’s dist/ and ds1/ folders. Keep that layout when you serve the files so the module can load its chunks and the stylesheet can find its fonts.
<code><span class="line"><span style="color:var(--docs-code-ink)"><</span><span style="color:var(--docs-code-tag)">link</span><span style="color:var(--docs-code-keyword)"> rel</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"stylesheet"</span><span style="color:var(--docs-code-keyword)"> href</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"./ds1.css"</span><span style="color:var(--docs-code-ink)">></span></span><span class="line"><span style="color:var(--docs-code-ink)"><</span><span style="color:var(--docs-code-tag)">script</span><span style="color:var(--docs-code-keyword)"> type</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"module"</span><span style="color:var(--docs-code-keyword)"> src</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"./ds1.js"</span><span style="color:var(--docs-code-ink)">></</span><span style="color:var(--docs-code-tag)">script</span><span style="color:var(--docs-code-ink)">></span></span></code>
jsDelivr serves the same files by version, at https://cdn.jsdelivr.net/npm/@0001-labs/design-system-1@latest/ or with an exact version in place of latest.