hdx-ui-components
v1.0.2
Published
Component library for the Hydrolix products
Maintainers
Readme
hdx-ui-components
Shared UI component library for the Hydrolix SaaS console and admin app. Includes reusable React components, hooks, utilities, i18n support, and theme tokens — built on Radix UI Themes and Next.js.
Installation
npm install hdx-ui-componentsPeer Dependencies
Install the required peer dependencies in your project if not already present:
npm install react react-dom next @radix-ui/themesUsage
1. Import the styles
Import the stylesheet once in your root layout:
// app/layout.tsx
import 'hdx-ui-components/dist/hdx-ui-components.css';2. Wrap your app with <Theme>
Components rely on Radix UI's Theme context. Add light-theme or dark-theme to <html> for FOUC prevention:
// app/layout.tsx
import { Theme } from '@radix-ui/themes';
import 'hdx-ui-components/dist/hdx-ui-components.css';
export default function RootLayout({ children }) {
return (
<html lang="en" className="light-theme">
<body>
<Theme>{children}</Theme>
</body>
</html>
);
}
light-theme/dark-themeis required. The stylesheet setsvisibility: hiddenon<html>until one of these classes is present (FOUC prevention). Without it the page will appear blank.
3. Import components
import { Button, Badge, Dialog, Spinner, DialogVariant } from 'hdx-ui-components';Components
Common
| Component | Description |
|---|---|
| Accordion / AccordionList | Collapsible content sections |
| AlertDialog | Confirmation dialogs requiring user action |
| Avatar | User avatar with fallback initials |
| Badge | Status/label badges |
| BarChart / LineChart / DonutChart | ECharts-based data visualisations |
| BrandLogo / BrandedSpinner | Hydrolix-branded logo and loading spinner |
| Button | Primary action button |
| Calendar | Date picker calendar |
| Callout | Inline alert/notification banners |
| Chip | Tag-style chips |
| ConfirmationDialog / Dialog | Modal dialogs |
| ContextMenu / DropdownMenu | Right-click and dropdown menus |
| DataList / DataSourceCard | Data display components |
| EmptyState | Empty state placeholder |
| ExternalLink | Styled external anchor |
| Footer / Header | Page layout primitives |
| HoverCard | Hover-triggered card popover |
| List / TableList / TableListBodyRow | List and table components |
| LoadingOverlay / Spinner / TableSkeleton | Loading states |
| MainPanel | Main content panel wrapper |
| OnboardingHeader | Onboarding flow header |
| Pagination | Page navigation |
| Popover | Floating content popover |
| ProgressBar | Linear progress indicator |
| Separator | Visual divider |
| Stepper | Multi-step progress indicator |
| TabList | Tabbed navigation |
| ToastAlert | Toast notification |
| Tooltip | Hover tooltip |
| Transition | Animated transitions |
| Unauthorized | 403 / unauthorised state |
Forms
| Component | Description |
|---|---|
| Checkbox | Controlled checkbox (react-hook-form) |
| RadioGroup / CardFieldView | Radio group variants |
| Switch | Toggle switch |
| Textarea | Multiline text input |
| InputField | Text / email / password input |
| SearchInput | Search input with clear button |
| SelectField | Dropdown select |
| TreeField | Checkbox tree selector |
| FormHeader | Form section header |
| LoginForm | Pre-built SSO login form |
Sidebar
| Component | Description |
|---|---|
| Sidebar | Collapsible navigation sidebar |
| SidebarMenuItem | Individual sidebar menu item |
Context & Providers
| Export | Description |
|---|---|
| AuthProvider / useAuth | Amplify-based authentication |
| ApiProvider / useApiContext | API client context |
| ProjectProvider / useProjectContext | Project selection context |
| SidebarProvider / useSidebar | Sidebar state |
| ThemeContextWrapper | Radix theme wrapper |
| BrandThemeProvider / useThemeSwitch | Light/dark theme switching |
| ToastContextProvider / useToasts | Toast notifications |
| IntlProviderWrapper | react-intl provider |
Hooks
useAppContext, useCustomer, useProjects, useUserPreferences, useEndUserClient
HOCs
withAuth, withAuthRedirect, withGuest
Utilities
DateUtils, StringUtils, useTranslation
Local Development
Prerequisites
- Node.js >= 20.0.0
- npm >= 10.0.0
Install dependencies
npm installRun Storybook
npm run storybookBuild the library
npm run build:libRun tests
npm testProject Structure
app/
components/ # React components (common, forms, sidebar, context, hooks, hocs)
api/ # API utilities
types/ # Shared TypeScript types and enums
config/ # Configuration (Amplify SSO)
i18n/ # Internationalisation strings
theme/ # Theme tokens
utils/ # Utility functions (DateUtils, StringUtils)Peer Dependencies
| Package | Version |
|---|---|
| react | ^18.2.0 |
| react-dom | ^18.2.0 |
| next | ^15.3.3 |
| @radix-ui/themes | ^3.0.0 |
