Thanks for your interest in contributing to React Theme Toggle! This guide covers code contributions and releasing.
src/
components/ToggleTheme.tsx # The component (inline styles, no CSS import)
index.ts # Public API
src/app/ # The demo site (Next.js)
tsup.config.ts # Library build (ESM + CJS + types)
.github/workflows/
ci.yml # Lint + typecheck + library build
deploy.yml # Demo site -> GitHub Pages
publish.yml # npm publish on version tags
bun install
bun run devRun the checks before opening a PR:
bun run lint
bun run typecheck
bun run build:lib- Branch. Work on a descriptive branch off
main, e.g.feat/controlled-uncontrolled. - Style. Match the existing conventions: TypeScript, readable multi-line formatting, and no dead code. Lint and typecheck must pass.
- Component. The component is rendered with inline styles so consumers
never need to import CSS. Keep it that way. It must stay fully
controlled (
selectedTheme+onChange) and accessible (checkbox + label, keyboard focusable,ariaLabel). - Demo. Showcase any new prop or behavior in
src/app/page.tsx. - PR. Open a pull request against
main. CI runs lint, typecheck, and the library build. Merges tomaindeploy the demo to GitHub Pages.
Releases are cut from version tags:
- Bump the version in
package.json(e.g.2.1.0). - Commit and push, then tag it:
git tag v2.1.0 && git push origin v2.1.0. - The
Publishworkflow builds the package and runsnpm publish.
The publish workflow needs an NPM_TOKEN secret (an npm access token)
configured in the repository settings. Without it the workflow will fail.