@esnet/packets-ui-web
v2.0.2
Published
The Packets Design System Web Components Package
Readme
@esnet/packets-ui-web
Framework-agnostic Web Components for the Packets Design System, a cross-organizational UI library from ESnet.
Installation
npm install @esnet/packets-ui-css @esnet/packets-ui-webPackets ships styles separately. You must install @esnet/packets-ui-css alongside the Web Components package.
Peer dependencies
npm install antd lucideSetup
1. Add the fonts
Add this to your <head>:
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Signika:[email protected]&family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
rel="stylesheet"
/>2. Import the styles and components
import "@esnet/packets-ui-css/styles.css";
import "@esnet/packets-ui-web";3. Add the root class
Add the packets class to your app's root element:
<body class="packets"></body>Optionally add dark or light:
<body class="packets dark"></body>Usage
Web Components work in any HTML environment or JavaScript framework:
<pkts-button variant="primary">Save</pkts-button>
<pkts-alert variant="success">Changes saved.</pkts-alert>
<pkts-avatar initials="JD" size="medium" color="grape"></pkts-avatar>Or in JavaScript:
import "@esnet/packets-ui-css/styles.css";
import "@esnet/packets-ui-web";
const button = document.createElement("pkts-button");
button.setAttribute("variant", "primary");
button.textContent = "Save";
document.body.appendChild(button);Available Components
Buttons
pkts-button: button; variantsprimary,secondary,branded,tertiary,destructivepkts-button-group: horizontal or vertical button grouppkts-icon-button: icon-only button with the same variants
Form Inputs
pkts-input-text: text inputpkts-input-email: email inputpkts-input-password: password inputpkts-input-number: number inputpkts-input-search: search inputpkts-input-checkbox: checkbox inputpkts-input-switch: toggle switchpkts-input-radio-button: radio buttonpkts-input-date: date inputpkts-input-date-picker/pkts-input-date-picker-date/pkts-input-date-picker-time: date picker and sub-componentspkts-input-date-range: date range picker
Display
pkts-alert: alert messages; variantserror,warning,success,infopkts-avatar: user avatar with initials; sizessmall,medium,largepkts-badge: badge/tagpkts-breadcrumbs: breadcrumb navigationpkts-card: card containerpkts-chip: chip tagpkts-chip-group: group of chipspkts-comma-separated-list: comma-separated listpkts-data-table: data tablepkts-datum: label/value pairpkts-divider: horizontal dividerpkts-icon: icon display
Layout
pkts-form-section: form section layoutpkts-module: module containerpkts-title-section: title section layout
Navigation
pkts-tabs: tab navigation
Utility
pkts-spinner: loading spinner
Dark Mode
Toggle dark mode by adding or removing the dark class on the root element:
document.body.classList.toggle("dark");Related Packages
| Package | Description |
| ---------------------------------------------------------------------------------- | ------------------------------------------ |
| @esnet/packets-ui-css | CSS-only components, no framework required |
| @esnet/packets-ui-react | React components |
License
MIT. See the root repository for full license details.
