Docs

Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

Scroller

Scroller is a component container for creating scrollable areas in the UI.

Open in a
new tab
Source code
ScrollerBasic.java

Scroll Direction

Scroller has four different scroll directions: vertical, horizontal, both and none. Scroller’s default scroll direction is both.

Vertical

When the scroll position is vertical, the user can scroll vertically if the content overflows the container vertically. Content that overflows horizontally is clipped and inaccessible, so the width of the content should be 100%.

Horizontal

When the scroll position is horizontal, the user can scroll horizontally if the content overflows the container horizontally. Content that overflows vertically is clipped and inaccessible, so the height of the content should be 100%.

Note

Use horizontal scrolling with caution, as it is much less common and may be difficult for users to recognize and use, in particular on non-mobile devices.

Desktop

Excluding Grids, horizontal scrolling is not commonly used in desktop and/or business applications as it can be non-obvious and cumbersome to use.

It is recommended to use using Buttons to help users notice and navigate horizontally scrollable sections. For horizontally scrollable lists, it is considered good practice to display how many list items there are and which items the user is viewing at the moment.

Mobile

Scrolling horizontally or swiping is more common on mobile, for example for navigation purposes. It can also be used to preserve vertical space, for example in situations where the user is exploring less important information, such as shortcuts or images.

Open in a
new tab
Source code
ScrollerMobile.java

Both

When the scroll position is Both (default), the user can scroll vertically and horizontally if the content overflows in both directions.

This scroll direction is best suited for allowing the user to pan around large elements, such as images. It can also be used as a fallback for a responsive layout that cannot be guaranteed not to overflow in some situations.

Open in a
new tab
Source code
ScrollerBoth.java

None

Use None to hide content that overflows in either direction. No scrollbars are available to the user for accessing the clipped content. None can be used in fixed size/layout situations, where overflow would cause issues.

Component Usage recommendations

Basic Layouts

Layouts that aligns components and HTML elements horizontally and vertically.

57E304CA-FD6F-4B64-8821-435C60B23ADD