gnome-ui
Components

Scroll Area

A native scroll container with stylable scrollbars. The required structure is `Root > Viewport > Content` — the `Scrollbar`s go **outside** the `Viewport`, as siblings within `Root`.

Scroll Area component
    import { ScrollArea } from "gnome-ui/scroll-area";

    export function ScrollAreaVertical() {
      return (
        <ScrollArea.Root className="h-48 w-80 rounded-xl border border-border bg-card overflow-hidden">
          <ScrollArea.Viewport className="h-full w-full">
            <ScrollArea.Content className="px-4 py-3">
              <p>Long content here...</p>
            </ScrollArea.Content>
          </ScrollArea.Viewport>
          {/* Scrollbar goes outside the Viewport */}
          <ScrollArea.Scrollbar orientation="vertical">
            <ScrollArea.Thumb />
          </ScrollArea.Scrollbar>
        </ScrollArea.Root>
      );
    }

Code Block

Ideal for code blocks with horizontal scroll. min-w-max on Content prevents text wrapping.

ScrollAreaContent

A container for the content of the scroll area. Renders a &lt;div&gt; element.

Documentation: Base UI Scroll Area

Props

PropTypeDefaultDescription
classNamestring | (...) => string)CSS class applied to the element, or a function that
returns a class based on the component’s state.
renderReactElement> | ComponentRenderFnAllows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

ScrollAreaCorner

A small rectangular area that appears at the intersection of horizontal and vertical scrollbars. Renders a &lt;div&gt; element.

Documentation: Base UI Scroll Area

Props

PropTypeDefaultDescription
classNamestring | (...) => string)CSS class applied to the element, or a function that
returns a class based on the component’s state.
renderReactElement> | ComponentRenderFnAllows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

ScrollAreaRoot

Groups all parts of the scroll area. Renders a &lt;div&gt; element.

Documentation: Base UI Scroll Area

Props

PropTypeDefaultDescription
classNamestring | (...) => string)CSS class applied to the element, or a function that
returns a class based on the component’s state.
renderReactElement> | ComponentRenderFnAllows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.
overflowEdgeThresholdnumber | Partial<{ xStart: number; xEnd: number; yStart: number; yEnd: number; }>0The threshold in pixels that must be passed before the overflow edge attributes are applied.
Accepts a single number for all edges or an object to configure them individually.

ScrollAreaScrollbar

A vertical or horizontal scrollbar for the scroll area. Renders a &lt;div&gt; element.

Documentation: Base UI Scroll Area

Props

PropTypeDefaultDescription
classNamestring | (...) => string)CSS class applied to the element, or a function that
returns a class based on the component’s state.
renderReactElement> | ComponentRenderFnAllows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.
orientation"horizontal" | "vertical"'vertical'Whether the scrollbar controls vertical or horizontal scroll.
keepMountedbooleanfalseWhether to keep the HTML element in the DOM when the viewport isn’t scrollable.

ScrollAreaThumb

The draggable part of the scrollbar that indicates the current scroll position. Renders a &lt;div&gt; element.

Documentation: Base UI Scroll Area

Props

PropTypeDefaultDescription
classNamestring | (...) => string)CSS class applied to the element, or a function that
returns a class based on the component’s state.
renderReactElement> | ComponentRenderFnAllows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

ScrollAreaViewport

The actual scrollable container of the scroll area. Renders a &lt;div&gt; element.

Documentation: Base UI Scroll Area

Props

PropTypeDefaultDescription
classNamestring | (...) => string)CSS class applied to the element, or a function that
returns a class based on the component’s state.
renderReactElement> | ComponentRenderFnAllows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

On this page