Skip to content

Conversation

@abolix
Copy link

@abolix abolix commented Sep 21, 2024

❓ 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

Hello,

I added a visibility option for Tooltips that checks if both the text prop and the slot are empty. If both are empty, the tooltip will not be shown at all. This is useful for situations where you have tooltips in a loop and want to display the tooltip for only some of the items in the loop.

@benjamincanac
Copy link
Member

benjamincanac commented Sep 23, 2024

Why add a tooltip if you don't pass text to it? πŸ€” You could also use the prevent="true" prop.

@abolix
Copy link
Author

abolix commented Sep 23, 2024

To be honest I didn't understand the prevent till after I saw the codes. It was a little confusing because there was no information about it in the docs.

I found the prevent prop a bit complex when using UTooltip with loop elements (in a v-for loop). To make it easier, I suggest hiding the tooltip when the text prop is empty.

This would provide a more intuitive way to manage tooltips in scenarios with dynamic content.

@benjamincanac benjamincanac changed the title Add isVisible computed property fix(Tooltip): hide when text prop / slot are empty Oct 2, 2024
@benjamincanac benjamincanac changed the title fix(Tooltip): hide when text prop / slot are empty fix(Tooltip): hide when text prop & slot are empty Oct 2, 2024
@benjamincanac
Copy link
Member

Would you mind fixing the lint?

@abolix
Copy link
Author

abolix commented Oct 2, 2024

fixed.

@benjamincanac
Copy link
Member

benjamincanac commented Oct 2, 2024

Now the typecheck πŸ˜… You have to import useSlots from vue.

@abolix
Copy link
Author

abolix commented Oct 2, 2024

sorry, fixed again, I got used to auto-importsπŸ˜„

@benjamincanac
Copy link
Member

Thanks! 😊

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