Composition & Layout
Scroll Area
Scroll Area adds a modern, subtle scrollbar track with a dynamic thumb for long content regions. Build a clear hierarchy with reusable structure, consistent spacing and semantic surfaces. Keep layout decisions close to the content they organize. Import it from @/components/kamod-ui/scroll-area.
Source · Design reference · API reference · Theming · Styles
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthInstallation
Import ScrollArea, ScrollBar, and optionally ScrollAreaCorner from @/components/kamod-ui/scroll-area.
pnpm add @kamod-ch/uiCopy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.
Usage
The root gets your size and border classes; scrolling happens in an inner viewport with native scrollbars hidden. Add ScrollBar for a draggable thumb (vertical default or orientation="horizontal"). When both axes scroll, add ScrollAreaCorner after the bars to mask the junction. The viewport exposes data-has-overflow-*, Data-Overflow-*-start|end, data-scrolling, and CSS variables such as --scroll-area-overflow-y-start for edge fades (set inherit on pseudo-elements if needed, per Base UI).
import { ScrollArea } from "@kamod-ch/ui";Choose a complete composition from the examples below; required child components and props vary by pattern.
Component Examples & Variants
Explore Scroll Area in Different Contexts, from the starting pattern to the compositions below. Begin with Vertical Feed, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.
Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.
Vertical Feed
Bound the Feed without Losing Its Context. Place a release feed inside a constrained ScrollArea so the surrounding screen can retain a compact layout. The vertical scrollbar makes the additional entries discoverable while each release remains part of one continuous list.
Make the area reachable and understandable for keyboard users, preserve sensible wheel and touch behavior, and avoid placing another vertical scroller inside each feed item.
import { ScrollBar } from "lucide-preact"
import { ScrollArea } from "@kamod-ch/ui";
export const Example = () => (
<ScrollArea class="h-56 rounded-xl border bg-card p-4">
<div class="space-y-3">
{Array.from({ length: 12 }).map((_, index) => (
<div key={index} class="rounded-lg border bg-background p-3">
<p class="text-sm font-medium">Release update #{index + 1}</p>
<p class="text-muted-foreground text-sm">
Scrollable content block with consistent spacing and modern card treatment.
</p>
</div>
))}
</div>
<ScrollBar />
</ScrollArea>
);Horizontal Gallery
Make Overflow Discoverable without Requiring a Drag Gesture. Use a horizontal ScrollArea for a sequence of visual cards that should stay in one row. An explicit horizontal scrollbar communicates that more items extend beyond the current view without depending on a swipe gesture alone.
Keep card labels readable, provide usable link targets, and test trackpad, keyboard and touch movement before relying on this pattern for important navigation.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthReading Container
Use a Scroll Region for a Deliberate Content Boundary. Constrain a documentation excerpt inside ScrollArea when it must share limited space with other content. Preserve readable text and an accessible scrolling region so the compact presentation does not make the explanation unreachable.
Choose a practical height, retain keyboard access and consider whether a full-height section would be simpler for the amount of content shown.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthCompact Chips
Keep a Long Tag Collection in One Compact Strip. Place a chip collection in a horizontal scroll region when keeping one row is useful. The bottom scrollbar indicates additional values, while the individual chips should remain readable and reachable through the intended input methods.
Keep chip targets usable and make selected or focused items visible; do not hide essential filtering options beyond an undiscoverable edge.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthVertical, Horizontal, and Corner
Reserve Two-Dimensional Scrolling for Content that Needs It. Render horizontal and vertical scrollbars with ScrollAreaCorner when content can exceed both dimensions. The corner fills their intersection, keeping the two scrolling directions visually coherent within one bounded viewport.
Include the corner treatment, keep each scrollbar reachable, and check that nested scroll regions do not make it difficult to return to ordinary page scrolling.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthProps and Data
Configure Scroll Area using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.
Props, slots and variants for this component.
Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.
Component Props
? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.ScrollArea
ScrollAreaProps
| Prop / type | Description |
|---|---|
children | Configure
|
class | Configure
|
ScrollAreaCorner
ScrollAreaCornerProps
| Prop / type | Description |
|---|---|
class | Configure
|
ScrollBar
ScrollBarProps
| Prop / type | Description |
|---|---|
class | Configure
|
onPointerDown | Configure
|
orientation | Configure
|
Data Type Reference
Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.
ScrollArea Props
1 declared fieldScrollAreaPropsScrollArea.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of ScrollAreaProps before adapting it.ScrollAreaCorner Props
DeclarationScrollAreaCornerPropsScrollAreaCorner.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of ScrollAreaCornerProps before adapting it.ScrollBar Props
1 declared fieldScrollBarPropsScrollBar.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of ScrollBarProps before adapting it.ScrollAreaContextValue
1 declared fieldScrollAreaContextValuescroll-area-context.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of ScrollAreaContextValue before adapting it.viewportRefAccessibility
ScrollArea provides a scrolling viewport and decorative custom scrollbar pieces. The scrollbar visuals are hidden from assistive technology; keyboard access depends on the actual viewport and its content, not on those decorative pieces.
You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.
Connect the Foundation
Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.
Build the Surrounding Screen
Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.
Make the Result Hold Up
Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.
Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.