Skip to content

feat(Dialog): add programmatic close functionality to dialog root#1943

Merged
zernonia merged 1 commit intounovue:v2from
JosephAnson:feat/expose-close-method-from-dialogroot
May 27, 2025
Merged

feat(Dialog): add programmatic close functionality to dialog root#1943
zernonia merged 1 commit intounovue:v2from
JosephAnson:feat/expose-close-method-from-dialogroot

Conversation

@JosephAnson
Copy link
Copy Markdown
Contributor

@JosephAnson JosephAnson commented May 26, 2025

🔗 Linked issue

I've made this PR to help support the change to NuxtUI, as it would reduce the amount of internal state needed: nuxt/ui#4219

❓ 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

Implemented programmatic close method for DialogRoot component.

New Feature:

  • Programmatic close method - Modal now exposes a close method through the #default scoped slot, allowing dialogs to be closed from within their content without requiring external ref management.

Documentation Updates:

  • Shows how to eliminate the need for manual v-model:open ref management.

Benefits:

  • No need to create and manage boolean refs for modal state
  • Reduces boilerplate code and cognitive load

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented May 27, 2025

Open in StackBlitz

npm i https://pkg.pr.new/reka-ui@1943

commit: 2a3dcd1

Copy link
Copy Markdown
Member

@zernonia zernonia left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @JosephAnson ! Simple and straightforward!

@zernonia zernonia merged commit 1ad5219 into unovue:v2 May 27, 2025
5 checks passed
@JosephAnson JosephAnson deleted the feat/expose-close-method-from-dialogroot branch May 27, 2025 18:25
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.

2 participants