Saltar al contenido principal

SideScroll

The SideScroll component creates a horizontal scrollable container for displaying content in a row. It's useful for creating carousels, image galleries, or any horizontal list of items that may overflow the available width. The component supports customizable scrollbar visibility, spacing between items, and scroll step configuration.

Usage

Example
import { Box, SideScroll, Text } from "@tiendanube/nube-sdk-jsx";
import type { NubeSDK } from "@tiendanube/nube-sdk-types";

function MyComponent() {
return (
<SideScroll width="400px" hideScrollbar>
{Array.from({ length: 10 }).map((_, index) => {
return (
<Box key={index.toString()} style={{ background: "red" }}>
<Text>{(index + 1).toString()}</Text>
</Box>
);
})}
</SideScroll>
);
}

export function App(nube: NubeSDK) {
nube.render("before_main_content", <MyComponent />);
}

Properties

PropertyTypeRequiredDescription
childrenNubeChildrenComponentNoArray of child components nested inside the scroll container.
widthSizeNoWidth of the scroll container (e.g., "100%", "400px").
gapSizeNoSpacing between child elements (e.g., "1rem", "16px").
hideScrollbarbooleanNoWhether to hide the scrollbar while keeping scroll functionality.
stepnumberNoNumber of pixels to scroll when using navigation controls.
styleNubeComponentStyleNoCustom styles for the scroll container.