Skip to content

Conversation

@J-Michalek
Copy link
Contributor

Resolves #2179

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 22, 2025

Open in StackBlitz

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

commit: 1943848

@J-Michalek J-Michalek changed the title feat(tooltip-provider): content configuration feat(TooltipProvider): content configuration Sep 24, 2025
Copy link
Collaborator

@sadeghbarati sadeghbarati left a comment

Choose a reason for hiding this comment

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

In TooltipContentImpl.vue it's better to use useForwardProps to fix undefined boolean casting curse 😄

Boolean Casting Curse in Vue is undefined boolean props will transfer to false instead of staying undefined

const props = withDefaults(defineProps<TooltipContentImplProps>(), {
  side: 'top',
  sideOffset: 0,
  align: 'center',
  avoidCollisions: true,
  collisionBoundary: () => [],
  collisionPadding: 0,
  arrowPadding: 0,
  sticky: 'partial',
  hideWhenDetached: false,
})

const delegatedProps = reactiveOmit(props, ['ariaLabel'])

const popperContentProps = computed(() => defu(delegatedProps.value, providerContext.content.value ?? {}))

const forwarded = useForwardProps(popperContentProps)

Then use forwarded like

- v-bind="{ ...$attrs, ...popperContentProps }"
+ v-bind="{ ...$attrs, ...forwarded }"

Related PR #610
vuejs/vue#4792

@J-Michalek
Copy link
Contributor Author

I've tried refactoring this, but it does not work as intended - the defu function gives the left most object the highest priority so if we set the default prop values then the providerContext.content.value will never have any effect and without the default values set we cannot use useForwardProps as it only returns the keys that are set on the props (atleast to my understanding) which are possibly all undefined as there would be no default values.

@J-Michalek
Copy link
Contributor Author

@sadeghbarati Just checking in if there are some changes to be done or if this can be merged.

@sadeghbarati
Copy link
Collaborator

Hello 👋

Zernonia is the maintainer
He should review, too

I can only merge the small PRs 😁

@zernonia
Copy link
Member

Im hesitant to this feature actually. Wouldn't it be much simpler if you create a generic Tooltip component (with defined Content configuration), and use it like that?

@J-Michalek
Copy link
Contributor Author

J-Michalek commented Oct 21, 2025

@zernonia I totally get your point, but my use case comes from using NuxtUI, which by default uses the bottom side for tooltips. Being able to configure it like this seems like a better solution than creating arbitrary components with predefined props.

If I was using RekaUI directly for tooltips then I would handle it in the component myself.

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.

[Feature]: global tooltip content configuration

3 participants