mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-22 12:15:43 +00:00
* feat: add field.tsx and update blocks * feat: add input group * feat: implement button group * fix * fix * wip * fix: button group * feat: update field * fix * feat * feat: cooked * fix * chore: build registry * feat: add kbd component * chore: update input group demo * feat: update kbd component * feat: add empty * feat: add spinner * refactor: input group * feat: blocks * fix * fix: app sidebar * feat: add label to app sidebar * fix * fix * fix * fix * fix * feat * feat * fix * docs: button group * feat: add docs * docs: kbd * docs: empty * fix * docs * docs * feat: add sink link * fix * fix * docs * feat: add new page * fix * fix * fix * fix * fix * fix * feat: add registration form * fix: chat settings * fix * fix preview * fix examples * feat: add changelog * fix * fix * fix * fix * fix * feat(www): add t3 versions * chore: build registry * fix * fix * fix * feat: inline code examples for llm * fix * feat: home * fix * fix * fix * fix * fix * chore: changelog * fix * fix * fix * fix: callout * fix
75 lines
1.7 KiB
Plaintext
75 lines
1.7 KiB
Plaintext
---
|
|
title: Scroll Area
|
|
description: Augments native scroll functionality for custom, cross-browser styling.
|
|
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
|
|
name="scroll-area-demo"
|
|
description="A scroll area component."
|
|
/>
|
|
|
|
## Installation
|
|
|
|
<CodeTabs>
|
|
|
|
<TabsList>
|
|
<TabsTrigger value="cli">CLI</TabsTrigger>
|
|
<TabsTrigger value="manual">Manual</TabsTrigger>
|
|
</TabsList>
|
|
<TabsContent value="cli">
|
|
|
|
```bash
|
|
npx shadcn@latest add scroll-area
|
|
```
|
|
|
|
</TabsContent>
|
|
|
|
<TabsContent value="manual">
|
|
|
|
<Steps>
|
|
|
|
<Step>Install the following dependencies:</Step>
|
|
|
|
```bash
|
|
npm install @radix-ui/react-scroll-area
|
|
```
|
|
|
|
<Step>Copy and paste the following code into your project.</Step>
|
|
|
|
<ComponentSource name="scroll-area" title="components/ui/scroll-area.tsx" />
|
|
|
|
<Step>Update the import paths to match your project setup.</Step>
|
|
|
|
</Steps>
|
|
|
|
</TabsContent>
|
|
|
|
</CodeTabs>
|
|
|
|
## Usage
|
|
|
|
```tsx showLineNumbers
|
|
import { ScrollArea } from "@/components/ui/scroll-area"
|
|
```
|
|
|
|
```tsx showLineNumbers
|
|
<ScrollArea className="h-[200px] w-[350px] rounded-md border p-4">
|
|
Jokester began sneaking into the castle in the middle of the night and leaving
|
|
jokes all over the place: under the king's pillow, in his soup, even in the
|
|
royal toilet. The king was furious, but he couldn't seem to stop Jokester. And
|
|
then, one day, the people of the kingdom discovered that the jokes left by
|
|
Jokester were so funny that they couldn't help but laugh. And once they
|
|
started laughing, they couldn't stop.
|
|
</ScrollArea>
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Horizontal Scrolling
|
|
|
|
<ComponentPreview name="scroll-area-horizontal-demo" />
|