Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with dynamic theme #382

Open
tPandzic opened this issue Nov 22, 2023 · 0 comments
Open

Issue with dynamic theme #382

tPandzic opened this issue Nov 22, 2023 · 0 comments

Comments

@tPandzic
Copy link

Hello!

I've been trying to create a custom component that integrates Tippy in our project and for the most part it works great.

However I've been having issues with "theme" prop. Im confused as to why am I getting undefined with theme, but everything else works as intended?

If I was to put theme as default to 'light' inside the component then it works, but dynamically nothing.

This is the component in question:

import Tippy from '@tippyjs/react';
import 'tippy.js/themes/light.css';
import 'tippy.js/themes/light-border.css';
import 'tippy.js/themes/material.css';
import 'tippy.js/themes/translucent.css';
import 'tippy.js/dist/tippy.css';

const Tooltip = ({ theme, content, placement, className, arrow, children }) => {
  return (
    <Tippy
      theme={theme}
      className={className}
      content={content}
      arrow={arrow}
      placement={placement}
    >
      {children}
    </Tippy>
  );
};

And this is how I am trying to call it in a random example:

 <Tooltip
        content='Total number of registered users.'
        placement='right'
        theme='light'
      >
        <div className='user-count-pill'>
          <span className='user-count'>{usersList?.length || 0}</span>
        </div>
 </Tooltip>

Thanks a lot for all the help you can provide.

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

No branches or pull requests

1 participant