0.1.0 • Published 2 years ago
@celcomdesign/prisma v0.1.0
Prisma Web Components
Visit prisma.celcom.com.my for samples, APIs and other design/development documentation
A design system / UI component library built with LitElement. Based on the web components standards, prisma is browser-, framework- and OS-agnostic and can be used to build web, desktop and mobile applications using Angular, Vue, React, plain JS and so on.
Installation
Install the library through npm:
npm install @celcomdesign/prisma --save
Integration of Components
Load the whole bundle
The most simple and common way of including the components into an application is by loading the core bundle:
// include bundle through module import
import '@celcomdesign/prisma'
// if using JS, css can also be imported. if using TS, use html stylesheet as shown below
import '@celcomdesign/prisma/prisma.css'
or
<!-- include bundle and styles in html file -->
<script type="text/javascript" charset="utf-8" src="node_modules/@celcomdesign/prisma/index.js"></script>
<link rel="stylesheet" type="text/css" href="node_modules/@celcomdesign/prisma/prisma.css">
Load single components
As an alternative, you can also load individual components to reduce loading time. Be aware that components are inter-dependent and should be imported independently:
// include individual components and styles through module import
import '@celcomdesign/prisma/components/button'
import '@celcomdesign/prisma/components/text'
// if using JS, css can also be imported. if using TS, use html stylesheet as shown below
import '@celcomdesign/prisma/prisma.css'
or
<!-- include single components and styles in html file -->
<script type="text/javascript" charset="utf-8" src="node_modules/@celcomdesign/prisma/components/button/index.js"></script>
<script type="text/javascript" charset="utf-8" src="node_modules/@celcomdesign/prisma/components/text/index.js"></script>
<link rel="stylesheet" type="text/css" href="node_modules/@celcomdesign/prisma/prisma.css">
Usage
Use the prisma components as if they were native HTML tags. All components allow one and two-way data binding and the attributes fire an <attribute>-changed
event when modified:
<prisma-button label="Hello World" color="secondary" disabled></prisma-button>
<!-- data binding -->
<prisma-accordion [label]="myVar" (expanded-changed)="myFunction()"></prisma-accordion>