Skip to content

Prepare react-tabs v7 with TypeScript and keyed selection - #641

Open
danez wants to merge 13 commits into
mainfrom
migrate-to-typescript
Open

danez wants to merge 13 commits into
mainfrom
migrate-to-typescript

Conversation

@danez

@danez danez commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Migrate the published library to TypeScript and generate its declarations from source.
  • Pair tabs and panels with a shared itemKey. Use defaultKey or selectedKey for selection and pass keys to onSelect. Arrow keys still follow the rendered tab order.
  • Use React context for tab state, remove the tabsRole wrapper marker, and use React's numeric tabIndex type.
  • Document the breaking changes and migration steps in MIGRATION.md, update the examples, and include major Changesets.

Verification

  • Lint, strict type checking, and all 100 tests passed.
  • The library and example site builds passed.
  • Packed declarations and server rendering passed with React 18 and 19. The migration guide examples type-check.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f6f91fe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-tabs Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📊 Package size report   -14.4%↓

File Before (Size / Gzip) After (Size / Gzip)
esm/components/Tab.d.ts — 134 B / 132 B
esm/components/Tab.js 998 B / 488 B 32%↑1.3 kB / 14%↑557 B
esm/components/TabList.d.ts — 150 B / 136 B
esm/components/TabList.js 349 B / 226 B 22%↑427 B / 14%↑258 B
esm/components/TabPanel.d.ts — 247 B / 197 B
esm/components/TabPanel.js 600 B / 334 B 59%↑956 B / 40%↑469 B
esm/components/Tabs.d.ts — 138 B / 133 B
esm/components/Tabs.js 2.4 kB / 944 B 377%↑11.3 kB / 206%↑2.9 kB
esm/components/TabsContext.d.ts — 634 B / 296 B
esm/components/TabsContext.js — 737 B / 395 B
esm/components/UncontrolledTabs.js 5.9 kB / 1.7 kB —
esm/helpers/childrenDeepMap.js 846 B / 299 B —
esm/helpers/count.js 205 B / 157 B —
esm/helpers/elementTypes.js 244 B / 144 B —
esm/helpers/propTypes.js 2.6 kB / 927 B —
esm/helpers/tabCollection.d.ts — 777 B / 331 B
esm/helpers/tabCollection.js — 3.2 kB / 991 B
esm/index.d.ts — 329 B / 138 B
esm/index.js 200 B / 94 B 25%↑250 B / 19%↑112 B
esm/types.d.ts — 1.8 kB / 559 B
esm/types.js — 11 B / 31 B
index.d.ts 2.0 kB / 542 B —
lib/components/Tab.js 1.2 kB / 577 B —
lib/components/TabList.js 555 B / 311 B —
lib/components/TabPanel.js 806 B / 422 B —
lib/components/Tabs.js 2.6 kB / 1.0 kB —
lib/components/UncontrolledTabs.js 6.2 kB / 1.8 kB —
lib/helpers/childrenDeepMap.js 1.0 kB / 344 B —
lib/helpers/count.js 325 B / 193 B —
lib/helpers/elementTypes.js 369 B / 187 B —
lib/helpers/propTypes.js 2.8 kB / 978 B —
lib/index.js 558 B / 209 B —
package.json 2.3 kB / 937 B -13.5%↓2.0 kB / -13.5%↓811 B
README.md 12.2 kB / 3.7 kB 29%↑15.8 kB / 34%↑4.9 kB
style/react-tabs.css 842 B / 369 B -12%↓741 B / -5.15%↓350 B
style/react-tabs.less 879 B / 391 B -10%↓791 B / -4.09%↓375 B
style/react-tabs.scss 879 B / 391 B -10%↓791 B / -4.09%↓375 B
Total (Includes all files) 51.0 kB / 18.4 kB -14.4%↓43.6 kB / -17.8%↓15.1 kB
Tarball size 11.6 kB 8%↑12.5 kB
Unchanged files
File Size (Size / Gzip)
LICENSE 1.1 kB / 653 B

🤖 This report was automatically generated by pkg-size-action

@danez
danez force-pushed the migrate-to-typescript branch from 4045307 to 8e03a86 Compare November 29, 2026 12:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant