# Scroll Area

Augments native scroll functionality for custom, cross-browser styling.

Section: Components / Layout
Page: https://ui.heyramzi.com/components/scroll-area
Import path: `@heyramzi/ui/shadcn/scroll-area`

## Import

```ts
import { ScrollArea } from "@heyramzi/ui/shadcn/scroll-area";
import { Separator } from "@heyramzi/ui/shadcn/separator";
```

## Usage

```svelte
<ScrollArea class="h-72 w-48 rounded-md border">
  {#each tags as tag (tag)}
    <div>{tag}</div>
  {/each}
</ScrollArea>
```

## Demo

```svelte
<script lang="ts">
	import { ScrollArea } from "@heyramzi/ui/shadcn/scroll-area";
	import { Separator } from "@heyramzi/ui/shadcn/separator";

	const tags = Array.from({ length: 50 }).map((_, i, a) => `v1.2.0-beta.${a.length - i}`);
</script>

<ScrollArea class="h-72 w-48 rounded-md border">
	<div class="p-4">
		<h4 class="mb-4 text-sm leading-none font-medium">Tags</h4>
		{#each tags as tag (tag)}
			<div class="text-sm">
				{tag}
			</div>
			<Separator class="my-2" />
		{/each}
	</div>
</ScrollArea>
```

## API

### ScrollArea.Root

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `orientation` | `"vertical"` \| `"horizontal"` \| `"both"` | `"vertical"` |  |
| `scrollbarXClasses` | `string \| undefined` | `""` |  |
| `scrollbarYClasses` | `string \| undefined` | `""` |  |
| `viewportRef` | `HTMLElement \| null` | `null` | bindable |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `ScrollArea.Root` from `bits-ui`, except `child`.

### ScrollArea.Scrollbar

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `orientation` | `string` | `"vertical"` |  |
| `children` | `Snippet` |  |  |

Every prop of `ScrollArea.Scrollbar` from `bits-ui`, except `child`.
