Component
scroll area
dx components add scroll_areaA scrollable area component.
Installation
Use the CLI command for the common path, or copy the component files manually.
Manual installation files
Copy the component source and CSS into your app. Import the shared theme CSS once near your app root.
use dioxus::prelude::*;
use dioxus_primitives::scroll_area::{self, ScrollAreaProps};
#[component]
pub fn ScrollArea(props: ScrollAreaProps) -> Element {
scroll_area::ScrollArea(props)
}Usage notes
The ScrollArea component is used to create a scrollable container for its children. It can be used to enable scrolling for content that overflows the available space.
Component Structure
// The ScrollArea component wraps all scrollable content.
ScrollArea {
// The direction in which the scroll area can scroll. Can be one of Horizontal, Vertical, or Both.
scroll_direction: ScrollDirection::Vertical,
// The content of the scrollable area
{children}
}Direction / RTL
ScrollArea accepts a dir: Option<Direction> prop, emitted as dir/data-direction on the root. This component wraps the browser's own native scrollbar (not a custom-drawn one), so the CSS Overflow spec's own dir-relative behavior repositions the scrollbar to the correct physical side automatically -- no additional logic is needed. See the rtl variant.
Variants
Alternative examples for common configurations.