5.24.1 • Published 9 months ago

@purpurds/slider v5.24.1

Weekly downloads
-
License
AGPL-3.0-only
Repository
-
Last release
9 months ago

import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";

import * as SliderStories from "./src/slider.stories"; import packageInfo from "./package.json";

Slider

Version {packageInfo.version}

This component can be used to get a range value or a single value.

  • Use an array of one number for the defaultValue / value and it will act as single.
  • Use an array of two numbers for the defaultValue / value and it will act as range.

Showcase

Properties

Installation

Via NPM

Add the dependency to your consumer app like "@purpurds/slider": "^x.y.z"

In MyApp.tsx

import "@purpurds/purpur/styles";

In MyComponent.tsx

Controlled slider

import { Slider } from "@purpurds/slider";

export const MyComponent = () => {
  const [value, setValue] = useState<[number, number]>([25, 50]);

  return (
    <Slider
      aria-label="thumb-aria-label"
      data-testid="slider"
      value={value}
      onValueChange={setValue}
    />
  );
};

Uncontrolled slider

When rendered in a form, an input reflecting the value of the slider will be rendered.

import { Slider } from "@purpurds/slider";

export const MyComponent = () => {
  return (
    <form>
      <Slider
        aria-label="thumb-aria-label"
        data-testid="slider-2"
        defaultValue={[10]}
        min={0}
        max={20}
        orientation="horizontal"
        name="my-slider"
        step={1}
      />
    </form>
  );
};
5.24.1

9 months ago

5.24.0

9 months ago

5.23.0

9 months ago

5.22.0

9 months ago

5.21.1

9 months ago

5.21.0

9 months ago

5.18.3

10 months ago

5.19.1

9 months ago

5.18.2

10 months ago

5.19.0

9 months ago

5.18.1

10 months ago

5.18.0

10 months ago

5.17.0

10 months ago

5.20.1

9 months ago

5.20.0

9 months ago

5.16.1

10 months ago

5.16.0

10 months ago

5.15.1

10 months ago

5.15.0

10 months ago

5.14.0

11 months ago

5.6.0

1 year ago

5.4.2

1 year ago

5.5.0

1 year ago

5.4.1

1 year ago

5.4.0

1 year ago

5.3.0

1 year ago

5.1.2

1 year ago

5.2.0

1 year ago

5.13.0

11 months ago

5.11.2

11 months ago

5.12.0

11 months ago

5.11.1

11 months ago

5.11.0

11 months ago

5.10.1

11 months ago

5.10.0

12 months ago

5.8.2

1 year ago

5.9.0

1 year ago

5.8.1

1 year ago

5.8.0

1 year ago

5.7.0

1 year ago

5.4.3

1 year ago

5.1.1

1 year ago

5.1.0

1 year ago

5.0.0

1 year ago

4.5.0

1 year ago

4.6.0

1 year ago

4.5.1

1 year ago

4.4.0

1 year ago

0.0.1

1 year ago