# V scroll area 10

> Basic scroll area

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-scroll-area-10).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-scroll-area-10
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-scroll-area-10-light-bff658b902f78eeb.png
- Registry item: https://ui.cnippet.dev/r/v-scroll-area-10.json
- Categories: scroll area
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-scroll-area-10.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/scroll-area`

## Files

### `registry/default/variants/v-scroll-area-10.tsx`

```tsx
import { ScrollArea } from "@/registry/default/ui/scroll-area";

const code = `import { useState, useEffect, useCallback } from "react";

type FetchState<T> =
  | { status: "idle" }
  | { status: "loading" }
  | { status: "success"; data: T }
  | { status: "error"; error: Error };

export function useFetch<T>(url: string) {
  const [state, setState] = useState<FetchState<T>>({
    status: "idle",
  });

  const fetch_ = useCallback(async () => {
    setState({ status: "loading" });
    try {
      const res = await fetch(url);
      if (!res.ok) {
        throw new Error(\`HTTP \${res.status}: \${res.statusText}\`);
      }
      const data: T = await res.json();
      setState({ status: "success", data });
    } catch (err) {
      setState({
        error: err instanceof Error ? err : new Error(String(err)),
        status: "error",
      });
    }
  }, [url]);

  useEffect(() => {
    fetch_();
  }, [fetch_]);

  return state;
}`;

export default function Particle() {
  return (
    <ScrollArea className="h-64 max-w-sm rounded-lg border bg-muted/30">
      <pre className="p-4 font-mono text-foreground text-xs leading-relaxed">
        <code>{code}</code>
      </pre>
    </ScrollArea>
  );
}
```
