Skip to content

feat(Textarea): expose autoResize method#6120

Open
Ken-vdE wants to merge 2 commits intonuxt:v4from
Ken-vdE:patch-1
Open

feat(Textarea): expose autoResize method#6120
Ken-vdE wants to merge 2 commits intonuxt:v4from
Ken-vdE:patch-1

Conversation

@Ken-vdE
Copy link

@Ken-vdE Ken-vdE commented Feb 28, 2026

Be able to call autoResize without forcefully triggering an Input (which could have other functional implications e.g. making api requests on input events).

❓ 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

Say you have a Textarea containing text and the window is resized; the autoResize will not be triggered (there are other cases too).
This change will allow you to do something like this:

const resizeDebouncer = useDebounceFn(() => {
    textareaTemplateRef.value.autoResize();
}, 500);
onMounted(() => {
    window.addEventListener('resize', resizeDebouncer);
});
onUnmounted(() => {
    window.removeEventListener('resize', resizeDebouncer);
});

Without manually triggering, say, an input event, which could have other implications when using a manual @update:modelValue"...".

📝 Checklist

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

Be able to call autoResize without forcefully triggering an Input (which could have other functional implications e.g. making api requests on input events).
@github-actions github-actions bot added the v4 #4488 label Feb 28, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

📝 Walkthrough

Walkthrough

The defineExpose block in the Textarea component has been modified to expose an additional internal function. The component now exposes both textareaRef and autoResize to external consumers, whereas previously only textareaRef was exposed. This change extends the public API surface of the component to include the resize functionality.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description is clearly related to the changeset, explaining the rationale for exposing autoResize and providing usage examples of how it solves the problem of resizing without triggering input events.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The pull request title accurately and concisely describes the main change: exposing the autoResize method from the Textarea component's public API.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 28, 2026

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

commit: 0436aaa

@benjamincanac benjamincanac changed the title Expose autoResize in Textarea.vue feat(Textarea): expose autoResize method Mar 14, 2026
Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, however we need to update the ### Expose section in textarea.md.

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.

2 participants