Stylhero
An accessible design system for React, Next.js and React Native, published on npm. One tokens file drives the web components, the mobile theme and the Tailwind setup, and the build refuses to ship colors that fail contrast.
- Role
- Solo: design, development, testing and releases
- Timeline
- October 2026 — Present
- Code
- GitHub
- React
- TypeScript
- Next.js
- React Native
- Tailwind CSS
- Puppeteer
- Jest
- GitHub Actions

- 93React components, from buttons to date pickers, DataGrid and charts, each with a docs page
- 110behavior and accessibility checks in a real browser, run against React 18 and 19
- 31React Native components for the mobile package, each with a docs page, and 161 tests
- 18color pairs contrast-checked in both themes on every build
The problem
BuildMyRig, its mobile app and this portfolio all needed the same things: buttons, inputs, dialogs, toasts, a color palette that works in dark mode. Each one was styling them from scratch, and they drifted apart.
Material UI covers the components, but brings its own look and a runtime styling layer (sx props, styled() and theme objects). I wanted plain CSS that works with or without Tailwind, components that can render on the server, and one source of truth for both web and mobile.
One tokens file, checked at build time
Every color (light and dark), font, type size, spacing step, radius and shadow lives in a single tokens.json. A build script generates everything else from it:
- CSS variables and a Tailwind v4 theme, so the bg-primary class and the --primary CSS variable are the same color.
- A Tailwind v3 preset, added when the first real app using it turned out to be on Tailwind v3.
- A typed React Native theme for the mobile package.
- A Claude design system, so the same tokens can be used when generating pages and slides.
- A theme command for other teams (stylhero-theme): it writes a theme from their own colors and fonts, but only after the same contrast checks pass in light and dark.
Accessibility the build enforces
Contrast isn't left to review. The token build checks 18 foreground and background pairs in both themes: text must reach 4.5:1, and the borders that identify a control (text inputs, selects, slider tracks) must reach 3:1. If a color change breaks either rule, the build stops and names the pair, so it can't reach a release.
Behavior is tested in a real browser. The playground renders every component on one page, and 110 Puppeteer checks drive it in headless Chrome: keyboard navigation in menus, tabs, the tree view and the date pickers, focus returning to the control that opened a menu or picker, combobox filtering, DataGrid sorting, search and selection, chart tooltips and table views, and no horizontal scroll at phone width. GitHub Actions runs them on every pull request against both React 18 and React 19, along with axe on every component in light and dark mode and on all 93 docs pages.
Layouts use logical CSS properties, so the components mirror for right-to-left languages like Arabic and Hebrew, arrows and sliding motion included.
The React Native package builds the same rules in: every pressable is at least 44×44pt, text follows the user's font size setting, motion is skipped under Reduce Motion, and controls tell screen readers their role, state and position ("tab, 2 of 4"). A date picker reads every day with its full date, and a slider can be changed by swiping up and down. It has 161 tests of its own, including one that renders every docs example.

Built for Next.js
The package ships one file per component, and only the interactive ones are marked "use client". Text, cards, badges, tables and the rest render as React Server Components and send no JavaScript to the browser.
Overlays use the browser's native dialog and details elements where the browser already does the work, and floating-ui for menus, popovers and tooltips. With Next.js's optimizePackageImports setting, this portfolio's home page went from 158 kB to 113 kB of first-load JavaScript.
Using it in a real app found the gaps
The demo page passed every check. Moving BuildMyRig's web and mobile apps onto it showed what the demo didn't:
- Input borders were about 1.3:1 against the background, too faint to see where a field starts. I added a line-strong token (at least 3:1) and made the build check it, so it can't regress.
- Next.js links failed the link types with React 18's type definitions. The link provider now accepts any component.
- The app was on Tailwind v3, not v4, which led to the generated v3 preset.
- On mobile, button labels were cut off at large text sizes, and form errors were read twice by screen readers when focus moved to the field. Labels now wrap, and forms that manage focus can turn the extra announcement off.
- The app's own loading row, game chips and resolution tiles had no Stylhero equivalent, so the spinner got a visible label, chips got checkbox and radio semantics, and radio groups got a card layout. The app then deleted its custom versions.
- Moving the budget and price-alert fields to the number input showed it couldn't be focused by a form and would have rounded a 2.5% alert to 3%. Both were fixed in the package, not worked around in the app.
Shipping it like a real package
Every change carries a changeset that becomes its changelog entry. Merging a version bump to main makes GitHub Actions run the typecheck, build and tests, publish to npm, tag the release and write the GitHub release notes.
Packages are published with npm provenance through trusted publishing: npm verifies that each release was built from this repository by its workflow, and no npm token is stored anywhere. The live demo and docs are rebuilt and redeployed whenever a component changes.
Pull requests also screenshot every component's live example in light and dark and compare it with main pixel by pixel, and check a bundle-size budget, so a visual change or a heavier import has to be on purpose.
What I'd do differently
Both packages have a docs page per component, generated from their TypeScript types, but the React Native pages show examples as code, since the components render natively. A live phone preview on each page (Expo Snack or react-native-web) would make them as easy to try as the web ones.
Screenshot comparison and axe only run on the web package. The native tests check roles, labels and states, but not how VoiceOver and TalkBack actually read them, which needs regular passes on real phones.