1.0.4 • Published 3 months ago

@spratch/whtable v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

WHTable - Accessible React Table Component

WHTable is a TypeScript React component providing an accessible, feature-rich table for WealthHealth applications. Built with React Aria Components and styled with Tailwind CSS.

Features

  • ✅ Fully accessible (WCAG compliant)
  • 🔍 Built-in search functionality
  • 📊 Sortable columns
  • 📏 Resizable columns
  • 🔢 Pagination
  • 🌓 Light and dark mode support
  • 🔄 Redux state management
  • 📱 Responsive design
  • 🏢 WealthHealth corporate design

Prerequisites

To use WHTable, you need:

  • React 19 or higher

Installation

npm install @spratch/whtable

Usage

Tailwind CSS

// index.jsx

import { WHTable } from "@spratch/whtable";

function YourComponent() {
  const employees = [
    {
      id: "1",
      firstName: "John",
      lastName: "Doe",
      startDate: "2023-01-15",
      department: "Engineering"
    }
    // more data...
  ];

  const columns = [
    { id: "firstName", title: "First Name" },
    { id: "lastName", title: "Last Name" },
    { id: "startDate", title: "Start Date" },
    { id: "department", title: "Department" }
  ];

  return (
    <WHTable
      itemsStatus="succeeded"
      itemsMessage=""
      items={employees}
      itemsName={{ singular: "employee", plural: "employees" }}
      newItemLink="/create-employee"
      lengthOptions={["10", "25", "50", "100"]}
      columnsTitles={columns}
      emailAddress="support@wealthhealth.com"
    />
  );
}

Props

PropTypeDescriptionDefault
itemsStatusstringLoading state ("idle", "loading", "succeeded", "failed")Required
itemsMessagestringMessage to display (e.g., error message)Required
itemsRecord<string, string>[]Array of data objectsRequired
itemsName{ singular: string, plural: string }Names for your data items{ singular: "item", plural: "items" }
newItemLinkstringLink to create a new itemundefined
lengthOptionsstring[]Options for page size["10", "25", "50", "100"]
columnsTitles{ id: string, title: string }[]Column definitionsRequired
emailAddressstringSupport email (shown on error)undefined

License

MIT

Issues

For bugs or feature requests, please open an issue on the GitHub repository.

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.0.1

4 months ago