Skip to content

Proposal ScrollArea | Make Scroll Area snapable on x, y or both x and y axis #989

Answered by benoitgrelard
joseDaKing asked this question in Ideas
Discussion options

You must be logged in to vote

hi @joseDaKing,

Because ScrollArea is built on top of a regular native scrolling container, all of this should work out of the box and be compatible with anything that a regular scrolling container can do.

For example, here's a demo using native CSS scroll snap:
https://codesandbox.io/s/scrollarea-scroll-snap-7umie

All I did to make this work is that the demo from our docs and add these 2 lines in the CSS:

const StyledViewport = styled(ScrollAreaPrimitive.Viewport, {
  width: '100%',
  height: '100%',
  borderRadius: 'inherit',
+  scrollSnapType: 'y mandatory',
});
const Tag = styled('div', {
  color: mauve.mauve12,
  fontSize: 13,
  lineHeight: '18px',
  marginTop: 10,
  borderTop: `1px …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joseDaKing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants