Skip to content

Commit f3ab021

Browse files
committed
vertical styles + parity
1 parent fac8178 commit f3ab021

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

sites/docs/src/lib/registry/default/ui/slider/slider.svelte

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
let {
66
ref = $bindable(null),
77
value = $bindable(),
8+
orientation = "horizontal",
89
class: className,
910
...restProps
1011
}: WithoutChildrenOrChild<SliderPrimitive.RootProps> = $props();
@@ -15,14 +16,23 @@ Discriminated Unions + Destructing (required for bindable) do not
1516
get along, so we shut typescript up by casting `value` to `never`.
1617
-->
1718
<SliderPrimitive.Root
18-
bind:value={value as never}
1919
bind:ref
20-
class={cn("relative flex w-full touch-none select-none items-center", className)}
20+
bind:value={value as never}
21+
{orientation}
22+
class={cn(
23+
"relative flex touch-none select-none items-center data-[orientation='vertical']:h-full data-[orientation='vertical']:min-h-44 data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-auto data-[orientation='vertical']:flex-col",
24+
className
25+
)}
2126
{...restProps}
2227
>
2328
{#snippet children({ thumbs })}
24-
<span class="bg-secondary relative h-2 w-full grow overflow-hidden rounded-full">
25-
<SliderPrimitive.Range class="bg-primary absolute h-full" />
29+
<span
30+
data-orientation={orientation}
31+
class="bg-secondary relative grow overflow-hidden rounded-full data-[orientation='horizontal']:h-2 data-[orientation='vertical']:h-full data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-2"
32+
>
33+
<SliderPrimitive.Range
34+
class="bg-primary absolute data-[orientation='horizontal']:h-full data-[orientation='vertical']:w-full"
35+
/>
2636
</span>
2737
{#each thumbs as thumb}
2838
<SliderPrimitive.Thumb

sites/docs/src/lib/registry/new-york/ui/slider/slider.svelte

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
55
let {
66
ref = $bindable(null),
7-
class: className,
87
value = $bindable(),
8+
orientation = "horizontal",
9+
class: className,
910
...restProps
1011
}: WithoutChildrenOrChild<SliderPrimitive.RootProps> = $props();
11-
12-
export { className as class };
1312
</script>
1413

1514
<!--
@@ -19,12 +18,21 @@ get along, so we shut typescript up by casting `value` to `never`.
1918
<SliderPrimitive.Root
2019
bind:ref
2120
bind:value={value as never}
22-
class={cn("relative flex w-full touch-none select-none items-center", className)}
21+
{orientation}
22+
class={cn(
23+
"relative flex touch-none select-none items-center data-[orientation='vertical']:h-full data-[orientation='vertical']:min-h-44 data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-auto data-[orientation='vertical']:flex-col",
24+
className
25+
)}
2326
{...restProps}
2427
>
2528
{#snippet children({ thumbs })}
26-
<span class="bg-primary/20 relative h-1.5 w-full grow overflow-hidden rounded-full">
27-
<SliderPrimitive.Range class="bg-primary absolute h-full" />
29+
<span
30+
data-orientation={orientation}
31+
class="bg-primary/20 relative grow overflow-hidden rounded-full data-[orientation='horizontal']:h-1.5 data-[orientation='vertical']:h-full data-[orientation='horizontal']:w-full data-[orientation='vertical']:w-1.5"
32+
>
33+
<SliderPrimitive.Range
34+
class="bg-primary absolute data-[orientation='horizontal']:h-full data-[orientation='vertical']:w-full"
35+
/>
2836
</span>
2937
{#each thumbs as thumb}
3038
<SliderPrimitive.Thumb

0 commit comments

Comments
 (0)