diff --git a/apps/www/__registry__/index.tsx b/apps/www/__registry__/index.tsx index 5648c92e91e..453d9b08b66 100644 --- a/apps/www/__registry__/index.tsx +++ b/apps/www/__registry__/index.tsx @@ -705,6 +705,13 @@ export const Index: Record = { component: React.lazy(() => import("@/registry/default/example/scroll-area-demo")), files: ["registry/default/example/scroll-area-demo.tsx"], }, + "scroll-area-horizontal-demo": { + name: "scroll-area-horizontal-demo", + type: "components:example", + registryDependencies: ["scroll-area"], + component: React.lazy(() => import("@/registry/default/example/scroll-area-horizontal-demo")), + files: ["registry/default/example/scroll-area-horizontal-demo.tsx"], + }, "select-demo": { name: "select-demo", type: "components:example", @@ -1721,6 +1728,13 @@ export const Index: Record = { component: React.lazy(() => import("@/registry/new-york/example/scroll-area-demo")), files: ["registry/new-york/example/scroll-area-demo.tsx"], }, + "scroll-area-horizontal-demo": { + name: "scroll-area-horizontal-demo", + type: "components:example", + registryDependencies: ["scroll-area"], + component: React.lazy(() => import("@/registry/new-york/example/scroll-area-horizontal-demo")), + files: ["registry/new-york/example/scroll-area-horizontal-demo.tsx"], + }, "select-demo": { name: "select-demo", type: "components:example", diff --git a/apps/www/content/docs/components/scroll-area.mdx b/apps/www/content/docs/components/scroll-area.mdx index 1244e4cc9ba..e84d626cf02 100644 --- a/apps/www/content/docs/components/scroll-area.mdx +++ b/apps/www/content/docs/components/scroll-area.mdx @@ -63,3 +63,9 @@ import { ScrollArea } from "@/components/ui/scroll-area" started laughing, they couldn't stop. ``` + +## Examples + +### Horizontal Scrolling + + diff --git a/apps/www/registry/default/example/scroll-area-horizontal-demo.tsx b/apps/www/registry/default/example/scroll-area-horizontal-demo.tsx new file mode 100644 index 00000000000..fad6de53485 --- /dev/null +++ b/apps/www/registry/default/example/scroll-area-horizontal-demo.tsx @@ -0,0 +1,53 @@ +import * as React from "react" +import Image from "next/image" + +import { ScrollArea, ScrollBar } from "@/registry/default/ui/scroll-area" + +export interface Artwork { + artist: string + art: string +} + +export const works: Artwork[] = [ + { + artist: "Ornella Binni", + art: "https://images.unsplash.com/photo-1465869185982-5a1a7522cbcb?auto=format&fit=crop&w=300&q=80", + }, + { + artist: "Tom Byrom", + art: "https://images.unsplash.com/photo-1548516173-3cabfa4607e9?auto=format&fit=crop&w=300&q=80", + }, + { + artist: "Vladimir Malyavko", + art: "https://images.unsplash.com/photo-1494337480532-3725c85fd2ab?auto=format&fit=crop&w=300&q=80", + }, +] + +export default function ScrollAreaHorizontalDemo() { + return ( + +
+ {works.map((artwork) => ( +
+
+ {`Photo +
+
+ Photo by{" "} + + {artwork.artist} + +
+
+ ))} +
+ +
+ ) +} diff --git a/apps/www/registry/default/ui/scroll-area.tsx b/apps/www/registry/default/ui/scroll-area.tsx index 590cec7fa18..2426616498a 100644 --- a/apps/www/registry/default/ui/scroll-area.tsx +++ b/apps/www/registry/default/ui/scroll-area.tsx @@ -35,7 +35,7 @@ const ScrollBar = React.forwardRef< orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" && - "h-2.5 border-t border-t-transparent p-[1px]", + "h-2.5 flex-col border-t border-t-transparent p-[1px]", className )} {...props} diff --git a/apps/www/registry/new-york/example/scroll-area-horizontal-demo.tsx b/apps/www/registry/new-york/example/scroll-area-horizontal-demo.tsx new file mode 100644 index 00000000000..d837e0a81f3 --- /dev/null +++ b/apps/www/registry/new-york/example/scroll-area-horizontal-demo.tsx @@ -0,0 +1,53 @@ +import * as React from "react" +import Image from "next/image" + +import { ScrollArea, ScrollBar } from "@/registry/new-york/ui/scroll-area" + +export interface Artwork { + artist: string + art: string +} + +export const works: Artwork[] = [ + { + artist: "Ornella Binni", + art: "https://images.unsplash.com/photo-1465869185982-5a1a7522cbcb?auto=format&fit=crop&w=300&q=80", + }, + { + artist: "Tom Byrom", + art: "https://images.unsplash.com/photo-1548516173-3cabfa4607e9?auto=format&fit=crop&w=300&q=80", + }, + { + artist: "Vladimir Malyavko", + art: "https://images.unsplash.com/photo-1494337480532-3725c85fd2ab?auto=format&fit=crop&w=300&q=80", + }, +] + +export default function ScrollAreaHorizontalDemo() { + return ( + +
+ {works.map((artwork) => ( +
+
+ {`Photo +
+
+ Photo by{" "} + + {artwork.artist} + +
+
+ ))} +
+ +
+ ) +} diff --git a/apps/www/registry/new-york/ui/scroll-area.tsx b/apps/www/registry/new-york/ui/scroll-area.tsx index 590cec7fa18..2426616498a 100644 --- a/apps/www/registry/new-york/ui/scroll-area.tsx +++ b/apps/www/registry/new-york/ui/scroll-area.tsx @@ -35,7 +35,7 @@ const ScrollBar = React.forwardRef< orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" && - "h-2.5 border-t border-t-transparent p-[1px]", + "h-2.5 flex-col border-t border-t-transparent p-[1px]", className )} {...props} diff --git a/apps/www/registry/registry.ts b/apps/www/registry/registry.ts index e7e8a366eaa..ee818d33ac7 100644 --- a/apps/www/registry/registry.ts +++ b/apps/www/registry/registry.ts @@ -611,6 +611,12 @@ const example: Registry = [ registryDependencies: ["scroll-area"], files: ["example/scroll-area-demo.tsx"], }, + { + name: "scroll-area-horizontal-demo", + type: "components:example", + registryDependencies: ["scroll-area"], + files: ["example/scroll-area-horizontal-demo.tsx"], + }, { name: "select-demo", type: "components:example",