Simple React data table component packaged as an npm library.
Install dependencies:
npm installBuild the package:
npm run buildRun the build in watch mode while developing:
npm run devimport { DataTable } from '@stereopt/data-table';
import '@stereopt/data-table/styles.css';
export function Example() {
return <DataTable />;
}The package stylesheet ships the component utilities only. It does not include Tailwind preflight, so it will not reset the consuming application's global styles.
The components also inherit the host application's theme automatically when the app exposes common semantic CSS variables such as --background, --foreground, --primary, --muted, --border, and related tokens. If needed, you can override the library specifically with the prefixed variables --st-dt-*.
Since the package uses Tailwind CSS, your consumer application must configure Tailwind to scan the package files so it generates the required utility classes.
In your global CSS file:
@import "tailwindcss";
@import "@stereopt/data-table/tailwind-source.css";That's it! The tailwind-source.css file contains the @source directive that tells Tailwind where to scan for the component classes.
Repository: https://github.com/StereoPT/data-table
- Update the
namefield inpackage.jsonif you want a different npm package name. - Bump the version in
package.json. - Log in to npm with
npm login. - Publish with
npm publish --access public.
If you use an npm scope such as @stereopt, make sure that scope exists in your npm organization.