Clarity Core Web Components
Clarity Core is a suite of Web Components for Clarity Design System.
Quick Start Install
-
First, install the Clarity Core package from npm.
npm install @cds/core --save
-
Import desired Web Component into your JavaScript or TypeScript
import '@cds/core/modal/register.js';
Full installation steps can be found in the Core Getting Started Guide.
Usage
No Framework
<cds-modal size="lg">
<p>slot content</p>
</cds-modal>
<script>
const modal = document.querySelector('cds-modal');
modal.addEventListener('closeChange', event => console.log(event));
modal.closable = true;
</script>
Angular
<cds-modal size="lg" [closable]="booleanValue" (closeChange)="log($event.detail)">
<p>slot content</p>
</cds-modal>
Vue
<cds-modal size="lg" :closable="booleanValue" @closeChange="log($event.detail)">
<p>slot content</p>
</cds-modal>
React via @cds/react
package
<CdsModal size="lg" closable={this.state.booleanValue} onCloseChange={this.log}>
<p>slot content</p>
</CdsModal>