|
| 1 | +--- |
| 2 | +title: Scroll Area |
| 3 | +description: Scroll Area component documentation |
| 4 | +--- |
| 5 | + |
| 6 | +The Scroll Area component provides a UI element for creating scrollable areas with custom scrollbars. It includes various customization options. |
| 7 | + |
| 8 | +import { DocsPage } from "@/components/docs-page"; |
| 9 | + |
| 10 | +<DocsPage.ComponentExample |
| 11 | + client:only |
| 12 | + code={`<ScrollArea className="h-24 w-64"> |
| 13 | + <div className="p-4"> |
| 14 | + <p>Scrollable content goes here.</p> |
| 15 | + <p>Scrollable content goes here.</p> |
| 16 | + <p>Scrollable content goes here.</p> |
| 17 | + <p>Scrollable content goes here.</p> |
| 18 | + <p>Scrollable content goes here.</p> |
| 19 | + </div> |
| 20 | +</ScrollArea>`} |
| 21 | +/> |
| 22 | + |
| 23 | +## Usage |
| 24 | + |
| 25 | +```typescript jsx |
| 26 | +import { ScrollArea } from '@harnessio/ui/components' |
| 27 | + |
| 28 | +return ( |
| 29 | + <ScrollArea |
| 30 | + className="h-64 w-64" |
| 31 | + viewportClassName="custom-viewport" |
| 32 | + > |
| 33 | + <div className="p-4"> |
| 34 | + <p>Scrollable content goes here.</p> |
| 35 | + <p>Scrollable content goes here.</p> |
| 36 | + <p>Scrollable content goes here.</p> |
| 37 | + <p>Scrollable content goes here.</p> |
| 38 | + <p>Scrollable content goes here.</p> |
| 39 | + </div> |
| 40 | + </ScrollArea> |
| 41 | +) |
| 42 | +``` |
| 43 | + |
| 44 | +## Anatomy |
| 45 | + |
| 46 | +The Scroll Area component can be used to create scrollable areas with custom scrollbars. |
| 47 | + |
| 48 | +```typescript jsx |
| 49 | +<ScrollArea className="h-64 w-64"> |
| 50 | + <div className="p-4"> |
| 51 | + <p>Scrollable content goes here.</p> |
| 52 | + <p>Scrollable content goes here.</p> |
| 53 | + <p>Scrollable content goes here.</p> |
| 54 | + <p>Scrollable content goes here.</p> |
| 55 | + <p>Scrollable content goes here.</p> |
| 56 | + </div> |
| 57 | +</ScrollArea> |
| 58 | +``` |
| 59 | + |
| 60 | +## API Reference |
| 61 | + |
| 62 | +### ScrollArea |
| 63 | + |
| 64 | +The `ScrollArea` component serves as the main container for the scrollable area. |
| 65 | + |
| 66 | +<DocsPage.PropsTable |
| 67 | + props={[ |
| 68 | + { |
| 69 | + name: "children", |
| 70 | + description: "The content to display inside the scroll area", |
| 71 | + required: true, |
| 72 | + value: "ReactNode", |
| 73 | + }, |
| 74 | + { |
| 75 | + name: "className", |
| 76 | + description: "Additional class names for the scroll area", |
| 77 | + required: false, |
| 78 | + value: "string", |
| 79 | + }, |
| 80 | + { |
| 81 | + name: "viewportClassName", |
| 82 | + description: "Additional class names for the viewport", |
| 83 | + required: false, |
| 84 | + value: "string", |
| 85 | + }, |
| 86 | + ]} |
| 87 | +/> |
| 88 | + |
| 89 | +### ScrollBar |
| 90 | + |
| 91 | +The `ScrollBar` component is used to display a custom scrollbar inside the scroll area. |
| 92 | + |
| 93 | +<DocsPage.PropsTable |
| 94 | + props={[ |
| 95 | + { |
| 96 | + name: "orientation", |
| 97 | + description: |
| 98 | + "The orientation of the scrollbar. Controls whether it appears on the side or bottom.", |
| 99 | + required: false, |
| 100 | + value: "'horizontal' | 'vertical'", |
| 101 | + defaultValue: "'vertical'", |
| 102 | + }, |
| 103 | + { |
| 104 | + name: "className", |
| 105 | + description: |
| 106 | + "Additional class names for styling the scrollbar's appearance", |
| 107 | + required: false, |
| 108 | + value: "string", |
| 109 | + }, |
| 110 | + ]} |
| 111 | +/> |
0 commit comments