@esnet/packets-ui-css
v0.1.1
Published
The Packets Design System CSS-Only Components
Downloads
454
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">Optionally add dark or light:
<body class="packets dark">Usage
All components use composable class names with the es- prefix. Combine a base component class with shared variant classes.
<button class="es-button es-primary">Primary</button>
<button class="es-button es-secondary">Secondary</button>
<button class="es-button es-destructive">Delete</button>Class system
.es-{component} // Base component
.es-{component}__{element} // Child element (BEM-style)
.es-{variant} // Shared variant or stateAvailable Components
Buttons
es-button: variantses-primary,es-secondary,es-branded,es-tertiary,es-destructive; sizeses-medium,es-xxlargees-icon-button: icon-only button with the same variantses-button-group: layout optionses-horizontal,es-vertical
Form Inputs
es-input-text: text inputes-input-email: email inputes-input-password: password inputes-input-number: number inputes-input-search: search inputes-input-checkbox: checkbox; variantses-brandedes-input-switch: toggle switch; variantses-secondary,es-checkedes-input-text-area: textarea; variantses-error
Display
es-alert: variantses-error,es-warning,es-success,es-infoes-avatar: sizeses-small,es-medium,es-large; colorses-grape,es-lime,es-berry,es-orangees-datum: label/value paires-divider: variantses-brandedes-icon: icon display
Layout
es-module: module containeres-form-section: form section layoutes-title-section: title section layoutes-spacer: layout optionses-horizontal,es-vertical,es-square
Navigation
es-breadcrumbs: breadcrumb navigationes-tabs/es-tab: tab navigation; statees-activees-table-of-contents: table of contentses-list-tree-view: tree view list
Data Display
es-data-table: semantic table using<table>,<thead>,<tbody>,<tfoot>es-comma-seperated-list: comma-separated list
Utility
es-spinner: loading spinneres-skeleton-surface: skeleton loader; variantses-rounded
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.
