Skip to content

Commit 608927e

Browse files
committed
fix(svelte): value text
1 parent cb1c606 commit 608927e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/svelte/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ description: All notable changes will be documented in this file.
1414

1515
### Fixed
1616

17+
- **Slider**: Fixed `Slider.ValueText` not displaying default value when no children provided
1718
- **Combobox**:
1819
- Fixed focus stealing in controlled open mode
1920
- Removed problematic `aria-hidden` behavior to allow interaction with other page elements
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<script module lang="ts">
2+
import type { Snippet } from 'svelte'
23
import type { HTMLProps, PolymorphicProps, RefAttribute } from '$lib/types'
34
4-
export interface SliderValueTextBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
5+
export interface SliderValueTextBaseProps extends PolymorphicProps<'div'>, RefAttribute {
6+
children?: Snippet
7+
}
58
export interface SliderValueTextProps extends HTMLProps<'div'>, SliderValueTextBaseProps {}
69
</script>
710

@@ -10,9 +13,15 @@
1013
import { Ark } from '../factory'
1114
import { useSliderContext } from './use-slider-context'
1215
13-
let { ref = $bindable(null), ...props }: SliderValueTextProps = $props()
16+
let { ref = $bindable(null), children, ...props }: SliderValueTextProps = $props()
1417
const slider = useSliderContext()
1518
const mergedProps = $derived(mergeProps(slider().getValueTextProps(), props))
1619
</script>
1720

18-
<Ark as="div" bind:ref {...mergedProps} />
21+
<Ark as="div" bind:ref {...mergedProps}>
22+
{#if children}
23+
{@render children()}
24+
{:else}
25+
{slider().value.join(', ')}
26+
{/if}
27+
</Ark>

0 commit comments

Comments
 (0)