IntervalSlider
A twin-handled slider control for specifying range values.
Integrates the Interval control from Tweakpane-creator Hiroki Kokubun's Essentials plugin.
Svelte Tweakpane UI extends the original implementation to by supporting tuple values in addition
to object values. It also exposes a meanValue prop for reading or setting the midpoint of the
interval range value.
Usage outside of a <Pane> component will implicitly wrap the interval slider in <Pane position="inline">.
Note that Svelte Tweakpane UI embeds a functionally identical fork of the plugin with build optimizations. The fork also changes the package name from @tweakpane/plugin-essentials to @kitschpatrol/tweakpane-plugin-essentials for consistency with other plugins.
Example
Section titled “Example”<script lang="ts"> import { IntervalSlider } from 'svelte-tweakpane-ui'
// Could specify convenience type IntervalSliderValueTuple here, or // use the object {start: number, end: number} instead of a tuple let value: [number, number] = [25, 75]</script>
<IntervalSlider bind:value min={0} max={100} format={(v) => `${v.toFixed(0)}%`}/><div class="demo" style:--e="{value[1]}%" style:--s="{value[0]}%"></div>
<style> div.demo { aspect-ratio: 1; width: 100%; background: linear-gradient(45deg, magenta var(--s), orange var(--e)); }</style>| bindablerequired | |
| Description | Interval value to control. Tuples are a convenience addition to the vanilla JS Tweakpane API. The value to control. |
|---|---|
| Type | IntervalSliderValue |
meanValueSection titled “meanValue” | |
| Description | Midpoint of the interval range value. |
|---|---|
| Type | number |
| Default | |
disabledSection titled “disabled” | |
| Description | Prevent interactivity and gray out the control. |
|---|---|
| Type | boolean |
| Default | false |
| optional | |
| Description | Text displayed next to control. |
|---|---|
| Type | string |
| Default | undefined |
| optional | |
| Description | Custom color scheme. |
|---|---|
| Type | Theme |
| Default | undefined Inherits default Tweakpane theme equivalent to ThemeUtils.presets.standard, or the theme
set with setGlobalDefaultTheme(). |
| optional | |
| Description | Minimum value. Specifying both a |
|---|---|
| Type | number |
| Default | undefined |
| optional | |
| Description | Maximum value. Specifying both a |
|---|---|
| Type | number |
| Default | undefined |
| optional | |
| Description | The minimum step interval. |
|---|---|
| Type | number |
| Default | undefined No step constraint. |
pointerScaleSection titled “pointerScale” | |
| Description | The unit scale for pointer-based input for all dimensions. |
|---|---|
| Type | number |
| Default | undefined Dynamic based on magnitude of value. |
keyScaleSection titled “keyScale” | |
| Description | The unit scale for key-based input for all dimensions (e.g. the up and down arrow keys). |
|---|---|
| Type | number |
| Default | 1 Or stepValue if defined. |
formatSection titled “format” | |
| Description | A function to customize the point value's string representation (e.g. rounding, etc.). |
|---|---|
| Type | ((value: number) => string) |
| Default | undefined Normal .toString() formatting. |
| optional | |
| Description | When |
|---|---|
| Type | boolean |
| Default | false |
Events
Section titled “Events”changeSection titled “change” | |
| Description | Fires when This event is provided for advanced use cases. It's usually preferred to bind to the The |
|---|---|
| Extends | ValueChangeEvent |
| Type | IntervalSliderChangeEvent |