> To build a Wix site agentically, or add Wix features like bookings or a store to a site you already have, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Slider Component

## Article: Slider Component

## Article Link: https://dev.wix.com/docs/wix-design-system/components/form/slider-component.md

## Article Content:

# Slider

_Components/Form_

Interactive docs page: <https://wix-pages.com/design-system-documentation/#/component/slider>

## Overview

```jsx
() => {
  const [value, setValue] = React.useState(50);

  return (
    <Layout>
      <Cell>
        <FormField label="Opacity">
          <Box gap="12px">
            <Box display="block" width="100%">
              <Slider
                onChange={(v) => setValue(Number(v))}
                min={0}
                max={100}
                value={value}
                displayMarks={false}
              />
            </Box>
            <Box width="60px">
              <Input
                value={value}
                onChange={(e) => setValue(Number(e.target.value))}
              />
            </Box>
          </Box>
        </FormField>
      </Cell>
    </Layout>
  );
};
```

Slider is an input field that enables our users to select a value within a given number range. It's handy when a user needs an approximate but not a precise value.

### Do

- Use it to adjust settings, such as opacity, brightness or volume.
- Use it to specify an accepted range of values, such as price range.
- Use it to control color opacity.

### Don't

- Don't use it to select a value within an extremely small range (e.g., 1-3). Use `<RadioGroup/>` or `<NumberInput/>` instead.

### Feature examples

#### Range

Specify a range of a slider by defining \`min\` and \`max\` values.

```jsx
<Slider min={1} max={20} value={3} />;
```

#### Values

Specifies what \`value\` slider will represent:\
 - \`number\` (default) - use it to select value within a given range.\
 - \`array\` - use it to select a range of values within a given range.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Slider min={0} max={50} value={10} />
  <Slider min={0} max={50} value={[10, 25]} />
</StorybookComponents.Stack>;
```

#### Start point

Control the starting point of a slider with \`startPoint\` prop. A default starting point is a minimum value from a defined range.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Slider startPoint={0} min={0} max={50} />
  <Slider startPoint={0} min={-25} max={25} />
</StorybookComponents.Stack>;
```

#### Marks

Use marks to indicate allowed selections that slider thumb will snap to. Marks are enabled by default, but can be hidden using \`displayMarks\` prop.\
\
Default marks display numeric values of start and end of a range.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Slider min={0} max={50} displayMarks={true} />
  <Slider min={0} max={50} displayMarks={false} />
</StorybookComponents.Stack>;
```

#### Marks label alignment

Control mark label alignment with the `marksLabelAlignment` prop, choose between:

- `center (default)` - marks title will overflow outside slider bounds.
- `inside` - marks will be aligned inside slider edges.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Slider min={-100} max={100} marksLabelAlignment="center" />
  <Slider min={-100} max={100} marksLabelAlignment="inside" />
</StorybookComponents.Stack>;
```

#### Marks label size

Set `marksLabelSize` to `tiny` or `small` to control the size of the marks labels. It defaults to `small`; `tiny` keeps a dense scale readable in narrow panels.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Slider min={0} max={100} marksLabelSize="small" />
  <Slider min={0} max={100} marksLabelSize="tiny" />
</StorybookComponents.Stack>;
```

#### Custom marks

Define custom marks for each accepted selection value via \`marks\` prop. It accepts numeric or string values.

```jsx
() => {
  const marks = {
    0: '$20',
    1: '$40',
    2: '$80',
    3: '$160',
    4: '$300',
    5: '$500',
  };

  return <Slider marks={marks} min={0} max={5} />;
};
```

#### Step

Define a step to reduce the amount of accepted values within a range. Default step is 1 and might not work well for larger value ranges, such as 1-1000.

```jsx
<Slider min={0} max={100} step={10} />;
```

#### Direction

Sets the slider's orientation:

`horizontal` (default), renders along the x‑axis.

`vertical`, renders along the y‑axis, useful for tight or tall layouts.

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Slider min={0} max={50} direction="horizontal" />
  <Box height="150px">
    <Slider min={0} max={5} direction="vertical" />
  </Box>
</StorybookComponents.Stack>;
```

#### Pushable & crossing handles

Control whether range slider handles should cross or push one another. By default handles are allowed to cross.

If \`pushable\` prop is set, moving the handle on top of another one will move the whole selected range.

If `allowCross={false}` users won't be able to cross the the handles

```jsx
() => {
  const [firstValue, setFirstValue] = React.useState([10, 25]);
  const [secondValue, setSecondValue] = React.useState([15, 30]);
  const [thirdValue, setThirdValue] = React.useState([20, 35]);

  return (
    <Box gap="20px" direction="vertical">
      <Text size="small">Crossing handles</Text>
      <Slider onChange={setFirstValue} min={0} max={50} value={firstValue} />

      <Text size="small">Pushable handles</Text>
      <Slider
        onChange={setSecondValue}
        min={0}
        max={50}
        value={secondValue}
        pushable={5}
      />

      <Text size="small">No crossing handles (allowCross=false)</Text>
      <Slider
        onChange={setThirdValue}
        min={0}
        max={50}
        value={thirdValue}
        allowCross={false}
      />
    </Box>
  );
};
```

#### Opacity

Use slider to control the opacity of a selected color with `gradientColor` prop.

Pass any color in color names, RGB or HEX formats.

```jsx
<Slider gradientColor="#229954" displayMarks={false} />;
```

#### Disabled

Disable all slider interactions with \`disabled\` prop. Use it to highlight a temporary unavailable function.

```jsx
<Slider min={1} max={10} disabled />;
```

### Common use case examples

#### Editable slider

Let users enter an exact value with an editable text field.

```jsx
() => {
  const [value, setValue] = React.useState(50);

  return (
    <Layout>
      <Cell>
        <FormField label="Opacity">
          <Box gap="12px">
            <Box display="block" width="100%">
              <Slider
                onChange={(v) => setValue(Number(v))}
                min={0}
                max={100}
                value={value}
                displayMarks={false}
              />
            </Box>
            <Box width="60px">
              <Input
                value={value}
                onChange={(e) => setValue(Number(e.target.value))}
              />
            </Box>
          </Box>
        </FormField>
      </Cell>
    </Layout>
  );
};
```

#### Color opacity

Use slider with the `gradientColor` prop to control the opacity of a selected color.

```jsx
() => {
  const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
  const [color, setColor] = React.useState('#B7EEFF');
  const [backgroundOpacity, setBackgroundOpacity] = React.useState(100);

  const changeBackgroundOpacity = (value) => {
    setBackgroundOpacity(value);
  };

  return (
    <FieldSet
      legend="Background color"
      columns="auto 72px 30px"
      alignment="center"
    >
      <Box marginRight="12px">
        <Slider
          displayMarks={false}
          gradientColor={color}
          min={0}
          max={100}
          value={backgroundOpacity}
          onChange={changeBackgroundOpacity}
        />
      </Box>
      <Input
        value={backgroundOpacity}
        suffix={<Input.Affix>%</Input.Affix>}
        size="small"
        onChange={(e) => changeBackgroundOpacity(e.target.value)}
      />
      <Box>
        <Popover
          showArrow
          shown={isPopoverOpen}
          appendTo="window"
          onClick={() => setIsPopoverOpen(!isPopoverOpen)}
          onClickOutside={() => setIsPopoverOpen(false)}
        >
          <Popover.Element>
            <FillPreview fill={color} />
          </Popover.Element>
          <Popover.Content>
            <ColorPicker
              value={color}
              onCancel={() => setIsPopoverOpen(false)}
              onConfirm={(value) => {
                setIsPopoverOpen(false);
                setColor(value.hex());
              }}
              onChange={() => {}}
            />
          </Popover.Content>
        </Popover>
      </Box>
    </FieldSet>
  );
};
```

#### Composer

Use sliders in a composer to let users adjust a variety of settings such as opacity, brightness, border radius, border weight, etc.

```jsx
() => {
  const renderSlider = ({ icon, text, initialValue }) => {
    const [value, setValue] = React.useState(initialValue);
    return (
      <FormField
        label=<Box verticalAlign="middle" gap="SP1">
          {icon}
          <Text>{text}</Text>
        </Box>
      >
        <Slider
          onChange={(v) => setValue(Number(v))}
          startPoint={0}
          min={-50}
          max={50}
          value={value}
          displayMarks={false}
        />
      </FormField>
    );
  };

  return (
    <SidePanel>
      <SidePanel.Header title="Adjust" />
      <SidePanel.Content>
        <Layout>
          <Cell>
            <Text size="small">Light & Color</Text>
          </Cell>
          <Cell>
            {renderSlider({
              icon: <Icons.BrightnessSmall />,
              text: 'Brightness',
              initialValue: -30,
            })}
          </Cell>
          <Cell>
            {renderSlider({
              icon: <Icons.ContrastSmall />,
              text: 'Contrast',
              initialValue: 25,
            })}
          </Cell>
          <Cell>
            {renderSlider({
              icon: <Icons.HighlightsSmall />,
              text: 'Highlights',
              initialValue: 25,
            })}
          </Cell>
          <Cell>
            {renderSlider({
              icon: <Icons.ShadowsSmall />,
              text: 'Shadows',
              initialValue: 0,
            })}
          </Cell>
        </Layout>
      </SidePanel.Content>
    </SidePanel>
  );
};
```

#### Form

Use a slider in a form to let users select a range of values, such as minimum and maximum values.

```jsx
() => {
  const [value, setValue] = React.useState({ min: 4, max: 12 });
  return (
    <Card>
      <Card.Header title="Party Size" />
      <Card.Divider />
      <Card.Content>
        <Layout>
          <Cell span={3}>
            <Box gap="12px">
              <FormField label="Min">
                <Input
                  value={value.min}
                  onChange={(e) =>
                    setValue({ ...value, min: Number(e.target.value) })
                  }
                />
              </FormField>
              <FormField label="Max">
                <Input
                  value={value.max}
                  onChange={(e) =>
                    setValue({ ...value, max: Number(e.target.value) })
                  }
                />
              </FormField>
            </Box>
          </Cell>
          <Cell span={9}>
            <FormField>
              <Slider
                onChange={(val) => setValue({ min: val[0], max: val[1] })}
                min={1}
                max={20}
                value={[value.min, value.max]}
              />
            </FormField>
          </Cell>
        </Layout>
      </Card.Content>
    </Card>
  );
};
```

#### Design panel

Use sliders to let users control color opacity and border width in a design panel.

- Use a slider with the `gradientColor` prop to let users control the opacity of a selected color.
- Let users enter an exact border width using an editable text field.

```jsx
() => {
  const [value, setValue] = React.useState(50);
  const [opacity, setOpacity] = React.useState(100);
  return (
    <SidePanel
      skin="floating"
      width="420px"
      closeButtonProps={{ onClick: () => {} }}
      helpButtonProps={{ onClick: () => {} }}
    >
      <SidePanel.Header title="Wix Comments" />
      <Box height="480px">
        <VerticalTabs size="small" activeTabId={2} onChange={() => {}}>
          <VerticalTabs.TabItem id={0}>Display</VerticalTabs.TabItem>
          <VerticalTabs.TabItem id={1}>Layout</VerticalTabs.TabItem>
          <VerticalTabs.TabItem id={2}>Design</VerticalTabs.TabItem>
          <VerticalTabs.TabItem id={3}>Text</VerticalTabs.TabItem>
        </VerticalTabs>
        <Divider direction="vertical" />
        <SidePanel.Content noPadding>
          <SidePanel.Field>
            <Button
              priority="secondary"
              size="tiny"
              prefixIcon={<Icons.ChevronLeft />}
            >
              Back
            </Button>
          </SidePanel.Field>
          <SidePanel.Field>
            <FieldSet legend="Text font and color" columns="auto 30px">
              <Button
                priority="secondary"
                size="small"
                suffixIcon={<Icons.TextSmall></Icons.TextSmall>}
              >
                Heading 1
              </Button>
              <FillPreview fill="#839788" aspectRatio={1} />
            </FieldSet>
          </SidePanel.Field>

          <SidePanel.Field>
            <FieldSet gap="small" legend="Border width" columns="auto 72px">
              <Slider
                onChange={(v) => setValue(Number(v))}
                min={0}
                max={100}
                value={value}
                displayMarks={false}
              />
              <Input
                value={value}
                size="small"
                suffix={<Input.Affix>px</Input.Affix>}
                onChange={(e) => setValue(Number(e.target.value))}
              />
            </FieldSet>
          </SidePanel.Field>
          <SidePanel.Field>
            <FieldSet
              legend="Background color"
              legendSize="small"
              legendPlacement="top"
              alignment="center"
              columns="30px auto 67px"
            >
              <FillPreview fill="#000000" aspectRatio={1} />
              <Box margin="0 8px">
                <Slider
                  gradientColor="#000000"
                  min={0}
                  max={100}
                  displayMarks={false}
                  onChange={(value) => setOpacity(Number(value))}
                  value={opacity}
                />
              </Box>
              <NumberInput
                value={opacity}
                min={0}
                max={100}
                onChange={(value) => setOpacity(value)}
                suffix={<Input.Affix>%</Input.Affix>}
                size="small"
                hideStepper
              />
            </FieldSet>
          </SidePanel.Field>
        </SidePanel.Content>
      </Box>
    </SidePanel>
  );
};
```

## Code

```jsx
import { Slider } from '@wix/design-system';
```

### Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `allowCross` | `boolean` | `true` | Allows sliders handles to cross. |
| `ariaLabelForHandle` | `string \| string[]` | — | Set the aria-label attributes for slider handles. |
| `dataHook` | `string` | — | Applies a data-hook HTML attribute that can be used in the tests. |
| `direction` | `"horizontal" \| "vertical"` | `'horizontal'` | Sets slider direction in either horizontal way or vertical. |
| `disabled` | `boolean` | `false` | Specifies whether interactions are disabled. |
| `displayMarks` | `boolean` | `true` | Controls the visibility of the marks. |
| `displayTooltip` | `boolean` | `true` | Controls visibility of slide handle tooltip. |
| `formatValue` | `(value: number) => string` | — | Formats the raw value for display in tooltip. |
| `gradientColor` | `string` | — | Converts slider to a slider with a gradient background. RGB, HEX formats or color names are accepted. ```javascript gradientColor="rgb(105, 110, 28)" gradientColor="#FFAC4B" gradientColor="pink" ``` If the color can't be parsed, a fallback color is applied. |
| `id` | `string` | — | Assigns an unique identifier for the root element. |
| `marks` | `{ [key: number]: string \| number; }` | — | Specifies slider marks. The key determines the position, and the value determines what is shown. The object structure should be either ```{ number : number}``` / ```{ number : string }``` |
| `marksLabelAlignment` | `"center" \| "inside"` | `'center'` | Sets the alignment of the marks labels. |
| `marksLabelSize` | `"small" \| "tiny"` | `'small'` | Controls the size of the marks labels. |
| `max` | `number` | `20` | Sets the absolute maximum value of sliders range. |
| `min` | `number` | `1` | Sets the absolute minimum value of the sliders range. |
| `onAfterChange` | `(value: NoInferType<TValue>) => void` | — | Defines a callback function which is called when ontouchend or onmouseup is triggered. |
| `onBeforeChange` | `(value: NoInferType<TValue>) => void` | — | Defines a callback function which is called when ontouchstart or onmousedown is triggered. |
| `onBlur` | `(value: number \| number[], event?: FocusEvent<Element, Element> \| undefined) => void` | — | Sets the onBlur callback for the slider's handle. ```javascript onBlur((handleValue) => ({})) ``` |
| `onChange` | `(value: NoInferType<TValue>) => void` | — | Defines a callback function which is called upon every value change. |
| `onFocus` | `(value: number \| number[], event?: FocusEvent<Element, Element> \| undefined) => void` | — | Sets the onFocus callback for the slider's handle. ```javascript onFocus((handleValue) => ({})) ``` |
| `pushable` | `number \| false \| true` | — | Push surrounding handles when moving a handle (relevant for multi value sliders only). Number specifies a minimum distance between handles. |
| `rtl` | `boolean` | `false` | Adjust component for RTL. |
| `startPoint` | `number` | `undefined` | Specifies the starting value of a track. If undefined, the minimum value of a range is used as a starting point. |
| `step` | `number` | `1` | Specifies the interval between range values. |
| `value` | `TValue` | `3` | Specifies the selected value. |

## Testkit

No testkit for this component — it doesn't expose a unidriver testkit.

## Changelog

- **1.344.0** (2026-10-28) — maintenance release, no component-specific changes
- **1.340.0** (2026-10-21) — maintenance release, no component-specific changes
- **1.339.0** (2026-10-19) — maintenance release, no component-specific changes
- **1.338.0** (2026-10-15) — maintenance release, no component-specific changes
- **1.330.3** (2026-09-29) — maintenance release, no component-specific changes
- **1.330.0** (2026-09-28) — maintenance release, no component-specific changes
- **1.329.0** (2026-09-24) — maintenance release, no component-specific changes
- **1.328.0** (2026-09-22) — maintenance release, no component-specific changes
- **1.325.0** (2026-09-17) — maintenance release, no component-specific changes
- **1.323.0** (2026-09-10) — maintenance release, no component-specific changes
- **1.320.0** (2026-09-03) — fix: the gradient slider's thumb outline is now a lighter tint of the selected color instead of a darker one. ColorPicker: the hue slider handle can now show a border in themes that define one. ([#17009](invalid-url)) — has visual changes
- **1.318.0** (2026-08-28) — maintenance release, no component-specific changes
- **1.317.0** (2026-08-26) — maintenance release, no component-specific changes
- **1.316.0** (2026-08-25) — feat: add a `marksLabelSize` prop to display mark labels in `tiny` or `small` sizes. ([#16857](invalid-url)) — has visual changes
- **1.310.0** (2026-08-10) — maintenance release, no component-specific changes
- **1.295.0** (2026-07-03) — maintenance release, no component-specific changes
- **1.292.0** (2026-06-22) — maintenance release, no component-specific changes
- **1.291.0** (2026-06-19) — maintenance release, no component-specific changes
- **1.282.0** (2026-05-27) — fix: allow handle interaction when wrapper is focused ([#16290](invalid-url))
- **1.278.0** (2026-05-08) — maintenance release, no component-specific changes
- **1.277.0** (2026-05-07) — maintenance release, no component-specific changes
- **1.266.0** (2026-04-07) — maintenance release, no component-specific changes
- **1.260.0** (2026-03-17) — maintenance release, no component-specific changes
- **1.247.2** (2026-01-21) — maintenance release, no component-specific changes
- **1.241.0** (2025-12-17) — maintenance release, no component-specific changes
- **1.221.0** (2025-10-15) — feat: introduce prop to format `Tooltip` value ([#15413](invalid-url))
- **1.212.0** (2025-08-11) — maintenance release, no component-specific changes
- **1.207.0** (2025-07-24) — maintenance release, no component-specific changes
- **1.170.0** (2025-03-12) — fix: fix isDisabled driver method ([#14588](invalid-url))
- **1.167.0** (2025-03-05) — feat: add driver methods to increase and decrease value ([#14584](invalid-url))
- **1.165.0** (2025-02-27) — maintenance release, no component-specific changes
- **1.138.1** (2024-10-30) — maintenance release, no component-specific changes
- **1.128.0** (2024-09-19) — maintenance release, no component-specific changes
- **1.126.0** (2024-09-09) — feat: add getValue testkit method ([#14113](invalid-url))
- **1.122.0** (2024-08-21) — feat: add marks label alignment to slider. ([#14039](invalid-url))
- **1.115.0** (2024-07-17) — maintenance release, no component-specific changes
- **1.103.1** (2024-04-24) — maintenance release, no component-specific changes
- **1.103.0** (2024-04-23) — fix: fix handle placement on studio theme ([#13637](invalid-url))
- **1.102.0** (2024-04-16) — breaking: reduced vertical margins for Slider ([#13602](invalid-url))
- **1.92.1** (2024-02-05) — maintenance release, no component-specific changes