Skip to content

feat: support ReactNode in ScrollVelocity texts prop#907

Open
mohamed-younes16 wants to merge 1 commit intoDavidHDev:mainfrom
mohamed-younes16:feat/scroll-velocity-reactnode-support
Open

feat: support ReactNode in ScrollVelocity texts prop#907
mohamed-younes16 wants to merge 1 commit intoDavidHDev:mainfrom
mohamed-younes16:feat/scroll-velocity-reactnode-support

Conversation

@mohamed-younes16
Copy link

Problem

texts: string[] limits content to plain text only, preventing common
real-world use cases like icons, styled spans, gradient text, and logos.

Before / After

// Before
texts={['React Bits', 'Scroll Down']}

// After — any ReactNode now works
texts={[
<> React Bits</>,
Scroll Down,
'Plain strings still work too ✅'
]}

Changes

  • texts: string[]texts: React.ReactNode[] in TS variants
  • &nbsp; separator moved inside the span (encapsulated in scroller)
  • numCopies! non-null assertion replaced with numCopies ?? 6
  • Prop table description updated in demo
  • Applied across all 4 variants (JS-CSS, JS-TW, TS-CSS, TS-TW)

Final Notes

Non-breaking — plain strings are valid ReactNode, so all existing usage continues to work unchanged.
Tested locally in dev and production build with no errors.

- Change texts: string[] to texts: React.ReactNode[] in TS variants
- Move &nbsp; separator inside the span (encapsulated in scroller)
- Replace numCopies! non-null assertion with numCopies ?? 6
- Update prop table description in demo to reflect ReactNode support
- Applied consistently across all 4 variants (JS-CSS, JS-TW, TS-CSS, TS-TW)

This is a non-breaking change — plain strings are valid ReactNode values,
so all existing usage continues to work. The change unlocks rich content
like icons, styled spans, gradients, and mixed JSX in the scrolling ticker.
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.

1 participant