snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
99
apps/v4/content/docs/components/radix/scroll-area.mdx
Normal file
99
apps/v4/content/docs/components/radix/scroll-area.mdx
Normal file
@@ -0,0 +1,99 @@
|
||||
---
|
||||
title: Scroll Area
|
||||
description: Augments native scroll functionality for custom, cross-browser styling.
|
||||
base: radix
|
||||
component: true
|
||||
links:
|
||||
doc: https://www.radix-ui.com/docs/primitives/components/scroll-area
|
||||
api: https://www.radix-ui.com/docs/primitives/components/scroll-area#api-reference
|
||||
---
|
||||
|
||||
<ComponentPreview
|
||||
styleName="radix-nova"
|
||||
name="scroll-area-demo"
|
||||
previewClassName="h-96"
|
||||
/>
|
||||
|
||||
## Installation
|
||||
|
||||
<CodeTabs>
|
||||
|
||||
<TabsList>
|
||||
<TabsTrigger value="cli">Command</TabsTrigger>
|
||||
<TabsTrigger value="manual">Manual</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="cli">
|
||||
|
||||
```bash
|
||||
npx shadcn@latest add scroll-area
|
||||
```
|
||||
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="manual">
|
||||
|
||||
<Steps className="mb-0 pt-2">
|
||||
|
||||
<Step>Install the following dependencies:</Step>
|
||||
|
||||
```bash
|
||||
npm install radix-ui
|
||||
```
|
||||
|
||||
<Step>Copy and paste the following code into your project.</Step>
|
||||
|
||||
<ComponentSource
|
||||
name="scroll-area"
|
||||
title="components/ui/scroll-area.tsx"
|
||||
styleName="radix-nova"
|
||||
/>
|
||||
|
||||
<Step>Update the import paths to match your project setup.</Step>
|
||||
|
||||
</Steps>
|
||||
|
||||
</TabsContent>
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
## Usage
|
||||
|
||||
```tsx showLineNumbers
|
||||
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"
|
||||
```
|
||||
|
||||
```tsx showLineNumbers
|
||||
<ScrollArea className="h-[200px] w-[350px] rounded-md border p-4">
|
||||
Your scrollable content here.
|
||||
</ScrollArea>
|
||||
```
|
||||
|
||||
## Composition
|
||||
|
||||
Use the following composition to build a `ScrollArea`:
|
||||
|
||||
```text
|
||||
ScrollArea
|
||||
└── ScrollBar
|
||||
```
|
||||
|
||||
## Horizontal
|
||||
|
||||
Use `ScrollBar` with `orientation="horizontal"` for horizontal scrolling.
|
||||
|
||||
<ComponentPreview styleName="radix-nova" name="scroll-area-horizontal-demo" />
|
||||
|
||||
## RTL
|
||||
|
||||
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
|
||||
|
||||
<ComponentPreview
|
||||
styleName="radix-nova"
|
||||
name="scroll-area-rtl"
|
||||
direction="rtl"
|
||||
previewClassName="h-auto"
|
||||
/>
|
||||
|
||||
## API Reference
|
||||
|
||||
See the [Radix UI Scroll Area](https://www.radix-ui.com/docs/primitives/components/scroll-area#api-reference) documentation.
|
||||
Reference in New Issue
Block a user