@esnet/packets-ui-react
v2.0.2
Published
The Packets Design System React Package
Readme
@esnet/packets-ui-react
React components for the Packets Design System, a cross-organizational UI library from ESnet.
Installation
npm install @esnet/packets-ui-css @esnet/packets-ui-reactPackets ships styles separately. You must install @esnet/packets-ui-css alongside the React package.
Peer dependencies
npm install react react-dom antd lucide-reactSetup
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
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
import { PktsButton, PktsAlert, PktsAvatar } from "@esnet/packets-ui-react";
function App() {
return (
<div>
<PktsButton variant="primary">Save</PktsButton>
<PktsAlert variant="success">Changes saved.</PktsAlert>
<PktsAvatar alt="JD" size="medium" backgroundColor="grape" />
</div>
);
}Available Components
Buttons
PktsButton: button; variantsprimary,secondary,branded,tertiary,destructive; renders asbuttonoravia theaspropPktsButtonGroup: horizontal or vertical button groupPktsIconButton: icon-only button with the same variants; renders asbuttonoravia theasprop
Form Inputs
PktsInputText/PktsInputTextArea: text inputsPktsInputEmail: email inputPktsInputPassword: password inputPktsInputNumber: number inputPktsInputSearch: search inputPktsInputCheckbox: checkbox inputPktsInputSwitch: toggle switchPktsInputRadioButton: radio buttonPktsInputSelect: select/dropdown inputPktsInputTypeahead: typeahead/autocomplete inputPktsInputOption: individual option item used insidePktsInputSelectandPktsInputTypeaheadPktsInputRow: form row wrapper providing label, caption, and validation layoutPktsInputDate/PktsInputDatePicker/PktsInputDateRange: date inputsPktsLabel: form label
Display
PktsAlert: alert messages; variantserror,warning,success,infoPktsAvatar: user avatar with initials; sizessmall,medium,largePktsBreadcrumbs: breadcrumb navigationPktsChip/PktsChipGroup: chip tags and chip groupingPktsCodeBlock: syntax-highlighted code blockPktsCommaSeperatedList: comma-separated listPktsDataTable: data tablePktsDatum: label/value pairPktsDivider: horizontal dividerPktsTooltip: tooltip
Layout
PktsAccordion: collapsible sectionPktsDropdown: dropdown containerPktsFormSection: form section layoutPktsModule: module containerPktsSpacer: layout spacerPktsTitleSection: title section layout
Navigation
PktsTab/PktsTabs: tab navigationPktsTableOfContents: table of contentsPktsListTreeView: tree view list
Utility
PktsSpinner: loading spinnerPktsSkeletonSurface: skeleton loader placeholder
Providers
PacketsDesignTokenProvider: context provider for design token overridesusePacketsDesignTokens: hook to access design tokens from context
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-web | Web Components, framework-agnostic |
License
MIT. See the root repository for full license details.
