Skip to content

refactor: remove forwardRef in favor of ref as a prop (React 19) - #124

Merged
joshunrau merged 1 commit into
mainfrom
react19
Oct 7, 2026
Merged

joshunrau merged 1 commit into
mainfrom
react19

Conversation

@joshunrau

Copy link
Copy Markdown
Collaborator

Summary

Removes every use of React.forwardRef from the library. Since we now support React 19 only, ref is passed as an ordinary prop to function components.

  • 47 components across ArrowToggle, Button, Card, Checkbox, DatePicker, DropdownButton, DropdownMenu, HoverCard, Input, Label, Popover, Select, Separator, Sheet, Slider, Table, Tabs, TextArea and Tooltip are now plain function components.
  • Wrappers around Radix primitives are typed with React.ComponentProps<typeof Primitive> instead of ComponentPropsWithoutRef + ElementRef. Wrappers around HTML elements use React.ComponentProps<'tag'>.
  • Exported props types now include ref, so consumers can keep passing refs: ButtonProps, ArrowToggleProps, InputProps, TextAreaProps, CalendarProps, DatePickerProps, PopoverContentProps, TooltipContentProps, TooltipTriggerProps, SheetContentProps, DropdownMenuContentProps.
  • JSX, class names, defaults and the order of ref and {...props} are unchanged.

Test plan

  • tsc --noEmit passes
  • eslint src passes
  • vitest run: 39 files, 201 tests passing

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshunrau
joshunrau merged commit 1349098 into main Oct 7, 2026
1 check passed
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 6.18.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant