Skip to content

Slider Bind Value #1560

Answered by huntabyte
sutaungmai asked this question in Help
Dec 17, 2024 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Ah, I see what you're trying to do now. Perhaps I will introduce the ability to have a single value for the slider rather than an array if it is a single-value slider.

In the meantime, until I make that update, you should be able to accomplish it like this. You will need to bind:options in the parent component that is providing the options and make the options prop $bindable in this component.

Something like this:

<script lang="ts">
	let { options = $bindable() } = $props()
</script>

<Slider value={options.length} onValueChange={(v) => {
	const newValue = v[0]
	options.length = newValue
})} />

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@sutaungmai
Comment options

@huntabyte
Comment options

@sutaungmai
Comment options

@huntabyte
Comment options

Answer selected by sutaungmai
@sutaungmai
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants