Intelligence Community Design System ICDS Get started Accessibility Styles Components Patterns Community
Show navigation section

Svelte

Step one

In the root of your project:

# using npm
npm install @ukic/web-components @ukic/fonts

# using yarn
rm package-lock.json
yarn add @ukic/web-components @ukic/fonts

Step two

Import defineCustomElements in yourmain.ts file.

import { defineCustomElements } from "@ukic/web-components/loader";

Step three

Call defineCustomElements in yourmain.ts file:

//other configuration
...
defineCustomElements();

Step four

Add the following into the top level CSS file for your project. For newly generated Svelte projects this will besrc/global.css .

@import "@ukic/fonts/dist/fonts.css";
@import "@ukic/web-components/dist/core/core.css";

In order to be rendered consistently across browsers and in line with modern standards, each of the components uses styles from a global CSS file based on Normalize.css .

If you would like to import these styles to apply them to the rest of your project and slotted elements used within any of the components, add the following into the top level CSS file as well.

@import "@ukic/web-components/dist/core/normalize.css";

Step five

In your HTML, you can now declare a component as follows:

<ic-status-tag label="Neutral"></ic-status-tag>

Last reviewed 23 December 2024 .
Navigated to Svelte - Intelligence Community Design System