@esnet/packets-ui-css
v2.0.2
Published
The Packets Design System CSS-Only Components
Readme
@esnet/packets-ui-css
CSS-only components for the Packets Design System, a cross-organizational UI library from ESnet.
Use this package if you want Packets styles without a JavaScript framework. For framework-specific wrappers see the related packages section at the bottom.
Installation
npm install @esnet/packets-ui-cssSetup
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
<!-- In HTML -->
<link
rel="stylesheet"
href="node_modules/@esnet/packets-ui-css/dist/styles.css"
/>/* In CSS */
@import "@esnet/packets-ui-css/styles.css";// In JavaScript
import "@esnet/packets-ui-css/styles.css";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
All components use composable class names with the pkts- prefix. Combine a base component class with shared variant classes.
<button class="pkts-button pkts-primary">Primary</button>
<button class="pkts-button pkts-secondary">Secondary</button>
<button class="pkts-button pkts-destructive">Delete</button>Class system
.pkts-{component} Base component
.pkts-{component}__{element} Child element (BEM-style)
.pkts-{variant} Shared variant or stateAvailable Components
Buttons
pkts-button: variantspkts-primary,pkts-secondary,pkts-branded,pkts-tertiary,pkts-destructivepkts-icon-button: icon-only button with the same variantspkts-button-group: layout optionspkts-horizontal,pkts-vertical
Form Inputs
pkts-input-text: text inputpkts-input-text-area: textarea; variantspkts-errorpkts-input-email: email inputpkts-input-password: password inputpkts-input-number: number inputpkts-input-search: search inputpkts-input-checkbox: checkbox; variantspkts-brandedpkts-input-switch: toggle switch; variantspkts-secondary,pkts-checkedpkts-input-radio: radio buttonpkts-input-select: select/dropdown inputpkts-input-typeahead: typeahead/autocomplete inputpkts-input-option: individual option itempkts-input-row: form row wrapper with label, caption, and validationpkts-input-date-picker: date pickerpkts-label: form label; positionspkts-label-top,pkts-label-left,pkts-label-right,pkts-label-bottom
Display
pkts-alert: variantspkts-error,pkts-warning,pkts-success,pkts-infopkts-avatar: sizespkts-small,pkts-medium,pkts-large; colorspkts-grape,pkts-lime,pkts-berry,pkts-orangepkts-badge: badge/tagpkts-card: card containerpkts-chip: chip tagpkts-chip-group: group of chipspkts-code-block: syntax-highlighted code blockpkts-datum: label/value pairpkts-divider: horizontal divider; variantspkts-brandedpkts-dropdown: dropdown containerpkts-icon: icon displaypkts-tooltip: tooltip; positionspkts-tooltip-top
Layout
pkts-accordion: collapsible sectionpkts-form-section: form section layoutpkts-module: module containerpkts-spacer: spacer; layout optionspkts-horizontal,pkts-vertical,pkts-squarepkts-title-section: title section layout
Navigation
pkts-breadcrumbs: breadcrumb navigationpkts-tab/pkts-tabs: tab navigation; statepkts-activepkts-table-of-contents: table of contentspkts-list-tree-view: tree view list
Data Display
pkts-data-table: semantic table using<table>,<thead>,<tbody>,<tfoot>pkts-comma-seperated-list: comma-separated list
Utility
pkts-spinner: loading spinnerpkts-skeleton-surface: skeleton loader placeholder; variantspkts-roundedpkts-skeleton-chip: skeleton chip loader
Dark Mode
Toggle dark mode by adding or removing the dark class on the root element:
document.body.classList.toggle("dark");Output Files
dist/styles.css: full unminified stylesheetdist/styles.min.css: minified stylesheetdist/tearsheet.html: visual component reference (open in a browser)
Related Packages
| Package | Description |
| ---------------------------------------------------------------------------------- | ---------------------------------- |
| @esnet/packets-ui-react | React components |
| @esnet/packets-ui-web | Web Components, framework-agnostic |
License
MIT. See the root repository for full license details.
