@lxjay/react-ui-test
v0.1.2
Published
Reusable React/Tailwind UI component library with Storybook, tests, and i18n support.
Readme
React Tailwind UI Library
A reusable React + Tailwind CSS component library scaffold that includes Storybook docs, Jest + React Testing Library tests, strict TypeScript, ESLint/Prettier, i18n (English, Norwegian Bokmål, Lithuanian), accessibility helpers, and light/dark theming.
Features
- React 18, TypeScript, Tailwind CSS 3 design system with tokens + dark mode via CSS variables.
- Component set: Button, Input, Select, Checkbox, Modal, Table, Tabs, Toast (with provider), Pagination, FormField.
- Storybook 7 with Docs/Controls, accessibility addon, Tailwind styling, design tokens, and preview decorators for Theme + Toast providers.
- Jest + React Testing Library with jsdom environment for fast unit tests.
- ESLint (TypeScript, React, Testing Library, jest-dom) + Prettier formatting.
- i18next setup with helper
initI18nand translations for English, Norwegian Bokmål, Lithuanian. - Build via tsup + Tailwind CLI, ready to publish to npm.
Scripts
pnpm install # install deps
pnpm lint # lint TS/React files
pnpm test # run unit tests
pnpm storybook # start Storybook on :6006
pnpm storybook:build # generate static Storybook
pnpm build # bundle components + CSS to dist/Development Workflow
- Install dependencies –
pnpm install(enable viacorepack enable pnpmif needed). - Run Storybook –
pnpm storybookfor component-driven development with live docs. - Add/Update components – implement in
src/components, export fromsrc/index.ts, document with astories/*.stories.tsxfile, and add relevant tests undersrc/components/__tests__. - Style with tokens – use Tailwind classes powered by
src/styles/tokens.css, or importtokensfrom@/tokensfor JS usage. Respect dark-mode via[data-theme="dark"]or the providedThemeProvider. - Internationalization – call
initI18n({ lng: 'nb' })when embedding in consuming apps; useuseTranslationfrom the library for UI text. - Testing & linting – run
pnpm testandpnpm lintbefore building. Thepnpm checkscript runs lint + test + build for CI safety. - Build artifacts –
pnpm buildoutputsdist/index.{cjs,mjs,d.ts}anddist/styles.css. Consumers import CSS viaimport '@ziliang/react-tailwind-ui/styles.css';. - Version & publish – bump the version in
package.json, runpnpm build, thennpm publish --access public(from the repo root, authenticated with npm).
Importing Components in Another App
import '@ziliang/react-tailwind-ui/styles.css';
import { Button, ThemeProvider, initI18n } from '@ziliang/react-tailwind-ui';
initI18n();
export const Example = () => (
<ThemeProvider>
<Button variant="secondary">Click me</Button>
</ThemeProvider>
);Project Structure
src/
components/ # All UI primitives
design-tokens/ # JS access to CSS tokens
i18n/ # i18next setup + locales
styles/ # Tailwind + CSS variables
theme/ # ThemeProvider + hook
utils/ # Shared helpers
stories/ # Storybook stories for each component
storybook/ # Storybook configPublishing Checklist
pnpm check- Update
README.md/ CHANGELOG if needed pnpm buildnpm publish --access public- Tag the release in git
Enjoy building accessible, themeable UI blocks!
