-
Is there a way go get to the scrollable element of the scrollarea to manage scroll programmatically ? And / or to assign an id to it ? I am having a hard time implementing a typewriter effect with it, and plug it with lazy load library. |
Beta Was this translation helpful? Give feedback.
Answered by
jjenzz
Jun 8, 2021
Replies: 1 comment 4 replies
-
This will all be much easier when we release the new version: const viewportRef = React.useRef<React.ElementRef<typeof ScrollArea.Viewport>>(null);
React.useEffect(() => {
viewportRef.current?.scrollTop = 100;
}, []);
return (
<ScrollArea.Root type="hover" scrollHideDelay={600}>
<ScrollArea.Viewport ref={viewportRef} id="whatever-you-like">
Lots of content...
</ScrollArea.Viewport>
<ScrollArea.Scrollbar orientation="horizontal">
<ScrollArea.Thumb />
</ScrollArea.Scrollbar>
<ScrollArea.Scrollbar orientation="vertical">
<ScrollArea.Thumb />
</ScrollArea.Scrollbar>
<ScrollArea.Corner />
</ScrollArea.Root>
); |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
olup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will all be much easier when we release the new version: