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

Add options on the SplitTextWrapper component #148

Closed
ReneDrie opened this issue Jun 21, 2023 · 2 comments
Closed

Add options on the SplitTextWrapper component #148

ReneDrie opened this issue Jun 21, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ReneDrie
Copy link

There are some options I think would make this component more useable.

  • Option to add a className as a prop to the rendered element
  • tag prop for what element is rendered (default a div, but span would fix hydration issues I believe

And this is perhaps a typing issue, but SplitText has an elements field, but it's not in the typing. Now it's impossible to reach the rendered wrapper element in code. How could we achieve this?

@ThaNarie
Copy link
Member

tag prop for what element is rendered (default a div, but span would fix hydration issues I believe

From what I understood, the last time I checked this, is that GSAP / SplitText doesn't support anything but div.
At least their documentation says so.

Do you have an example that shows that you can change it? And if so, I presume it only works for certain modes (e.g. never in line mode, maybe only in word/char mode where it doesn't wrap over multiple lines?)

@ReneDrie
Copy link
Author

tag prop for what element is rendered (default a div, but span would fix hydration issues I believe

From what I understood, the last time I checked this, is that GSAP / SplitText doesn't support anything but div. At least their documentation says so.

Do you have an example that shows that you can change it? And if so, I presume it only works for certain modes (e.g. never in line mode, maybe only in word/char mode where it doesn't wrap over multiple lines?)

I'm not talking about the tags that SplitText itself renders, you can already change that with the tag option in the SplitTextVariables. While this does cause some issues (which can be resolved by setting the elements to display: inline-block), for me it gives cleaner output.

But I'm talking about the div that the SplitTextWrapper always renders, to apply the SplitText on. I think this could also perfectly be a span as option, because that should resolve Hydration issues when rendering it in a <p> tag.

@leroykorterink leroykorterink added the enhancement New feature or request label Oct 9, 2023
leroykorterink added a commit that referenced this issue Oct 9, 2023
…he-splittextwrapper-component

#148 Make SplitTextWrapper polymorphic and add option to provide any …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants