Slider
Generated from public Vue/TypeScript exports by
pnpm docs:generate. Edit source comments and stories to update this reference. Types describe the declared API; browser/device constraints are covered in the guides. This catalog reflects source commitfc6bfb108634735f1657e533206c3f8702ad357d; match your installed package and typed manifest before using an export. Source review does not establish registry-release availability.
Slider
import { Slider } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
defaultValue | number[] | undefined | — | The value of the slider when initially rendered. Use when you do not need to control the state of the slider. |
modelValue | number[] | null | undefined | — | The controlled value of the slider. Can be bind as v-model. |
disabled | boolean | undefined | — | When true, prevents the user from interacting with the slider. |
orientation | DataOrientation | undefined | — | The orientation of the slider. |
dir | Direction | undefined | — | The reading direction of the combobox when applicable. <br> If omitted, inherits globally from ConfigProvider or assumes LTR (left-to-right) reading mode. |
inverted | boolean | undefined | — | Whether the slider is visually inverted. |
min | number | undefined | — | The minimum value for the range. |
max | number | undefined | — | The maximum value for the range. |
step | number | undefined | — | The stepping interval. |
minStepsBetweenThumbs | number | undefined | — | The minimum permitted steps between multiple thumbs. |
thumbAlignment | ThumbAlignment | undefined | — | The alignment of the slider thumb. - contain: thumbs will be contained within the bounds of the track. - overflow: thumbs will not be bound by the track. No extra offset will be added. |
asChild | boolean | undefined | — | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
as | AsTag | Component | undefined | — | The element or component this component should render as. Can be overwritten by asChild. |
name | string | undefined | — | The name of the field. Submitted with its owning form as part of a name/value pair. |
required | boolean | undefined | — | When true, indicates that the user must set the value before the owning form can be submitted. |
Events
| Name | Type | Required / default | Description |
|---|---|---|---|
update:modelValue | [payload: number[] | undefined] | — | — |
valueCommit | [payload: number[]] | — | — |
Examples
These are authored Storybook excerpts, not complete standalone modules. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Slider } from '.'
import { ref } from 'vue'
{
render: () => ({
components: { Slider },
setup() {
const value = ref([50])
return { value }
},
template: `
<div class="w-full max-w-sm">
<Slider v-model="value" :max="100" :step="1" />
<p class="mt-2 text-sm text-muted-foreground">Value: {{ value[0] }}</p>
</div>
`,
}),
}
WithDefaultValue
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Slider } from '.'
import { ref } from 'vue'
{
name: 'With Default Value',
render: () => ({
components: { Slider },
setup() {
const value = ref([33])
return { value }
},
template: `
<div class="w-full max-w-sm">
<Slider v-model="value" :default-value="[33]" :max="100" :step="1" />
<p class="mt-2 text-sm text-muted-foreground">Value: {{ value[0] }}</p>
</div>
`,
}),
}
Range
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { Slider } from '.'
import { ref } from 'vue'
{
name: 'Range',
render: () => ({
components: { Slider },
setup() {
const value = ref([25, 75])
return { value }
},
template: `
<div class="w-full max-w-sm">
<Slider v-model="value" :max="100" :step="1" />
<p class="mt-2 text-sm text-muted-foreground">Range: {{ value[0] }} - {{ value[1] }}</p>
</div>
`,
}),
}