diff --git a/sites/docs/content/components/scroll-area.md b/sites/docs/content/components/scroll-area.md index 2de6c4e8c..5a5073787 100644 --- a/sites/docs/content/components/scroll-area.md +++ b/sites/docs/content/components/scroll-area.md @@ -4,7 +4,7 @@ description: Consistent scroll area across platforms. --- @@ -25,9 +25,7 @@ description: Consistent scroll area across platforms. - - - + @@ -39,4 +37,64 @@ description: Consistent scroll area across platforms. ``` +## Scroll Area Types + +### Hover + +The `hover` type is the default type of the scroll area, demonstrated in the featured example above. It only shows scrollbars when the user hovers over the scroll area and the content is larger than the viewport. + +### Scroll + +The `scroll` type displays the scrollbars when the user scrolls the content. This is similar to the behavior of MacOS. + +```svelte + + + +``` + + + +{#snippet preview()} + +{/snippet} + + + +### Auto + +The `auto` type behaves similarly to your typical browser scrollbars. When the content is larger than the viewport, the scrollbars will appear and remain visible at all times. + +```svelte + + + +``` + + + +{#snippet preview()} + +{/snippet} + + + +### Always + +The `always` type behaves as if you set `overflow: scroll` on the scroll area. Scrollbars will always be visible, even when the content is smaller than the viewport. + +```svelte + + + +``` + + + +{#snippet preview()} + +{/snippet} + + + diff --git a/sites/docs/src/lib/components/component-preview-min.svelte b/sites/docs/src/lib/components/component-preview-min.svelte new file mode 100644 index 000000000..cad2d1557 --- /dev/null +++ b/sites/docs/src/lib/components/component-preview-min.svelte @@ -0,0 +1,26 @@ + + + + {@render preview?.()} + + + Show code + + + {@render children?.()} + + + diff --git a/sites/docs/src/lib/components/component-preview-v2.svelte b/sites/docs/src/lib/components/component-preview-v2.svelte index 75b92c556..98e80e46b 100644 --- a/sites/docs/src/lib/components/component-preview-v2.svelte +++ b/sites/docs/src/lib/components/component-preview-v2.svelte @@ -6,14 +6,15 @@ type Props = { preview: Snippet; children: Snippet; + class?: string; }; - let { preview, children }: Props = $props(); + let { preview, children, class: className }: Props = $props(); {@render preview()} - + {@render children()} diff --git a/sites/docs/src/lib/components/demo-code-container.svelte b/sites/docs/src/lib/components/demo-code-container.svelte index dcbff1fed..bba318dbf 100644 --- a/sites/docs/src/lib/components/demo-code-container.svelte +++ b/sites/docs/src/lib/components/demo-code-container.svelte @@ -8,8 +8,9 @@ type Props = { children: Snippet; + class?: string; }; - let { children }: Props = $props(); + let { children, class: className }: Props = $props(); const items = [ { @@ -40,7 +41,8 @@
{#if item.value === "App.svelte"} diff --git a/sites/docs/src/lib/components/demos/index.ts b/sites/docs/src/lib/components/demos/index.ts index d18c97482..3aa1767a9 100644 --- a/sites/docs/src/lib/components/demos/index.ts +++ b/sites/docs/src/lib/components/demos/index.ts @@ -26,6 +26,9 @@ export { default as ProgressDemo } from "./progress-demo.svelte"; export { default as RadioGroupDemo } from "./radio-group-demo.svelte"; export { default as RangeCalendarDemo } from "./range-calendar-demo.svelte"; export { default as ScrollAreaDemo } from "./scroll-area-demo.svelte"; +export { default as ScrollAreaDemoAlways } from "./scroll-area-demo-always.svelte"; +export { default as ScrollAreaDemoAuto } from "./scroll-area-demo-auto.svelte"; +export { default as ScrollAreaDemoScroll } from "./scroll-area-demo-scroll.svelte"; export { default as SelectDemo } from "./select-demo.svelte"; export { default as SeparatorDemo } from "./separator-demo.svelte"; export { default as SliderDemo } from "./slider-demo.svelte"; diff --git a/sites/docs/src/lib/components/demos/scroll-area-demo-always.svelte b/sites/docs/src/lib/components/demos/scroll-area-demo-always.svelte new file mode 100644 index 000000000..6e9dfcd6e --- /dev/null +++ b/sites/docs/src/lib/components/demos/scroll-area-demo-always.svelte @@ -0,0 +1,39 @@ + + + + +

+ Scroll Area +

+

+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dignissimos impedit rem, + repellat deserunt ducimus quasi nisi voluptatem cumque aliquid esse ea deleniti eveniet + incidunt! Deserunt minus laborum accusamus iusto dolorum. Lorem ipsum dolor sit, amet + consectetur adipisicing elit. Blanditiis officiis error minima eos fugit voluptate + excepturi eveniet dolore et, ratione impedit consequuntur dolorem hic quae corrupti + autem? Dolorem, sit voluptatum. +

+
+ + + + + + + +
diff --git a/sites/docs/src/lib/components/demos/scroll-area-demo-auto.svelte b/sites/docs/src/lib/components/demos/scroll-area-demo-auto.svelte new file mode 100644 index 000000000..511df2e41 --- /dev/null +++ b/sites/docs/src/lib/components/demos/scroll-area-demo-auto.svelte @@ -0,0 +1,39 @@ + + + + +

+ Scroll Area +

+

+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dignissimos impedit rem, + repellat deserunt ducimus quasi nisi voluptatem cumque aliquid esse ea deleniti eveniet + incidunt! Deserunt minus laborum accusamus iusto dolorum. Lorem ipsum dolor sit, amet + consectetur adipisicing elit. Blanditiis officiis error minima eos fugit voluptate + excepturi eveniet dolore et, ratione impedit consequuntur dolorem hic quae corrupti + autem? Dolorem, sit voluptatum. +

+
+ + + + + + + +
diff --git a/sites/docs/src/lib/components/demos/scroll-area-demo-scroll.svelte b/sites/docs/src/lib/components/demos/scroll-area-demo-scroll.svelte new file mode 100644 index 000000000..03d02413b --- /dev/null +++ b/sites/docs/src/lib/components/demos/scroll-area-demo-scroll.svelte @@ -0,0 +1,39 @@ + + + + +

+ Scroll Area +

+

+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Dignissimos impedit rem, + repellat deserunt ducimus quasi nisi voluptatem cumque aliquid esse ea deleniti eveniet + incidunt! Deserunt minus laborum accusamus iusto dolorum. Lorem ipsum dolor sit, amet + consectetur adipisicing elit. Blanditiis officiis error minima eos fugit voluptate + excepturi eveniet dolore et, ratione impedit consequuntur dolorem hic quae corrupti + autem? Dolorem, sit voluptatum. +

+
+ + + + + + + +
diff --git a/sites/docs/src/lib/components/demos/scroll-area-demo.svelte b/sites/docs/src/lib/components/demos/scroll-area-demo.svelte index 22ccf8586..ff5fe9529 100644 --- a/sites/docs/src/lib/components/demos/scroll-area-demo.svelte +++ b/sites/docs/src/lib/components/demos/scroll-area-demo.svelte @@ -6,9 +6,7 @@ class="relative overflow-hidden rounded-[10px] border border-dark-10 bg-background-alt px-4 py-4 shadow-card" > -

+

Scroll Area

diff --git a/sites/docs/src/lib/components/index.ts b/sites/docs/src/lib/components/index.ts index 9653abad6..1fb23ec59 100644 --- a/sites/docs/src/lib/components/index.ts +++ b/sites/docs/src/lib/components/index.ts @@ -15,3 +15,4 @@ export { default as ComponentPreview } from "./component-preview.svelte"; export { default as LightSwitch } from "./light-switch.svelte"; export { default as Metadata } from "./metadata.svelte"; export { default as ComponentPreviewV2 } from "./component-preview-v2.svelte"; +export { default as ComponentPreviewMin } from "./component-preview-min.svelte";