Scroll Area
draco-china-github/scroll-area-exampleFreeExample
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/draco-china/shadcn-pro/main/apps/docs/public/r/styles/radix-sera/scroll-area-example.jsonSource
1import * as React from "react"2import Image from "next/image"34import {5 Example,6 ExampleWrapper,7} from "@/registry/radix-sera/components/example"8import { ScrollArea, ScrollBar } from "@/registry/radix-sera/ui/scroll-area"9import { Separator } from "@/registry/radix-sera/ui/separator"1011const tags = Array.from({ length: 50 }).map(12 (_, i, a) => `v1.2.0-beta.${a.length - i}`13)1415const works = [16 {17 artist: "Ornella Binni",18 art: "https://images.unsplash.com/photo-1465869185982-5a1a7522cbcb?auto=format&fit=crop&w=300&q=80",19 },20 {21 artist: "Tom Byrom",22 art: "https://images.unsplash.com/photo-1548516173-3cabfa4607e9?auto=format&fit=crop&w=300&q=80",23 },24 {25 artist: "Vladimir Malyav",26 art: "https://images.unsplash.com/photo-1494337480532-3725c85fd2ab?auto=format&fit=crop&w=300&q=80",27 },28] as const2930export default function ScrollAreaExample() {31 return (32 <ExampleWrapper>33 <ScrollAreaVertical />34 <ScrollAreaHorizontal />35 </ExampleWrapper>36 )37}3839function ScrollAreaVertical() {40 return (41 <Example title="Vertical">42 <ScrollArea className="mx-auto h-72 w-48 overflow-hidden rounded-md border style-lyra:rounded-none style-maia:rounded-2xl style-luma:rounded-2xl style-sera:rounded-none">43 <div className="p-4">44 <h4 className="mb-4 text-sm leading-none font-medium">Tags</h4>45 {tags.map((tag) => (46 <React.Fragment key={tag}>47 <div className="text-sm">{tag}</div>48 <Separator className="my-2" />49 </React.Fragment>50 ))}51 </div>52 </ScrollArea>53 </Example>54 )55}5657function ScrollAreaHorizontal() {58 return (59 <Example title="Horizontal">60 <ScrollArea className="mx-auto w-full max-w-96 overflow-hidden rounded-md border p-4 **:data-[slot=scroll-area-viewport]:rounded-md style-lyra:rounded-none style-lyra:**:data-[slot=scroll-area-viewport]:rounded-none style-maia:rounded-2xl style-luma:rounded-2xl style-sera:rounded-none style-sera:**:data-[slot=scroll-area-viewport]:rounded-none">61 <div className="flex gap-4">62 {works.map((artwork) => (63 <figure key={artwork.artist} className="shrink-0">64 <div className="overflow-hidden rounded-md style-lyra:rounded-none style-sera:rounded-none">65 <Image66 src={artwork.art}67 alt={`Photo by ${artwork.artist}`}68 className="aspect-3/4 h-fit w-fit object-cover"69// … truncated
What it pulls in
Other registry items
Files it writes
More from shadcn/ui
All 201 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion-example | shadcn/ui | Examples | Free | no deps | |
| Alert Dialogalert-dialog-example | shadcn/ui | Examples | Free | no deps | |
| Alertalert-example | shadcn/ui | Examples | Free | no deps | |
| Aspect Ratioaspect-ratio-example | shadcn/ui | Examples | Free | no deps | |
| Avataravatar-example | shadcn/ui | Examples | Free | no deps | |
| Badgebadge-example | shadcn/ui | Examples | Free | no deps | |
| Breadcrumbbreadcrumb-example | shadcn/ui | Examples | Free | no deps | |
| Buttonbutton-example | shadcn/ui | Examples | Free | no deps |
