Skip to content

Conversation

@benjamincanac
Copy link
Member

@benjamincanac benjamincanac commented Nov 4, 2025

πŸ”— Linked issue

Fixes #5380, follow-up on #5358

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR standardizes exposed refs across components to always expose the underlying HTML element instead of the component instance.

⚠️ Breaking change on InputMenu, InputNumber, InputTags, Select, SelectMenu

const inputMenu = useTemplateRef('inputMenu')

- inputMenu.value.inputRef.$el // Component instance (ComboboxInput, etc.)
+ inputMenu.value.inputRef // HTML element (HTMLInputElement) directly

If you were accessing component-specific methods via inputRef.$el, update your code to use inputRef directly.

Other changes

  • Internal refactoring: switched from ref() to useTemplateRef()
  • Added missing "Expose" documentation sections for components with exposed refs

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@github-actions github-actions bot added the v4 #4488 label Nov 4, 2025
@benjamincanac
Copy link
Member Author

@J-Michalek I ended up using toRef instead of a getter in defineExpose, it was easier to type the output.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 4, 2025

npm i https://pkg.pr.new/@nuxt/ui@5385

commit: 1ebda6f

@benjamincanac benjamincanac changed the title fix(components): consistent exposed refs fix(components)!: consistent exposed refs Nov 4, 2025
@benjamincanac
Copy link
Member Author

@J-Michalek I pushed another commit to consistently expose the actual html element.

I feel bad for introducing yet another breaking change but it didn't make sense to have inputRef as HTMLInputElement on Input.vue and as InstanceType<ComboboxInput> on InputMenu.vue 😬

What do you think?

@J-Michalek
Copy link
Contributor

@benjamincanac Yeah exposing the same type for input based components makes sense!

@benjamincanac benjamincanac merged commit fce2df4 into v4 Nov 4, 2025
16 checks passed
@benjamincanac benjamincanac deleted the pr/5380 branch November 4, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loss of reactivity of textareaRef from ChatPrompt

3 participants