1.5.2 • Published 5 months ago

@fabharikad/scroll-picker v1.5.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Overview

  • This package is simple and flexible wheel picker for React
  • This package move like same as native applications picker
  • This package support accessibility

Usage

  • npm i react-simple-wheel-picker or yarn add react-simple-wheel-picker
  • Look at simple example below or please check example if you want to know more detail usage
import WheelPicker from "react-simple-wheel-picker";

const data = [
  {
    id: "1",
    value: "test1",
  },
  {
    id: "2",
    value: "test2",
  },
  {
    id: "3",
    value: "test3",
  },
  {
    id: "4",
    value: "test4",
  },
  {
    id: "5",
    value: "test5",
  },
];

const Sample = () => {
  const handleOnChange = (target) => {
    console.log(target);
  };
  return (
    <WheelPicker
      data={data}
      onChange={handleOnChange}
      height={150}
      width={100}
      titleText="Enter value same as aria-label"
      itemHeight={30}
      selectedID={data[0].id}
      color="#ccc"
      activeColor="#333"
      bgColor="#fff"
    />
  );
};

Normal Props

propstyperequiredescription
dataArray<{id: string, value: string | number}>trueIt should be array of object that have id and value
selectedIDstringtrueYou can set default data id
onChangefunction(data: PickerData): voidtrueYou can get value or id
heightnumbertrueYou can specify height to wheel picker
itemHeightnumbertrueYou can specify item height to wheel picker item
widthnumberfalseYou can specify width to wheel picker
idNamestringfalseYou can specify id name to have relation to htmlFor label element
colorstringfalseYou can specify color to picker value
activeColorstringfalseYou can specify active color to picker value
fontSizenumberfalseYou can specify font size to picker value
bgColorstringfalseYou can specify background color to wheel picker
shadowColorstringfalseYou can specify shadow color to wheel picker
focusColorstringfalseYou can specify focus color that is painted border color when WheelPicker is focused
refWheelPickerReffalseYou can refer element to use focus or blur function by specifying ref props

Accessibility Props

propstyperequiredescription
titleIDstringfalseYou can specify titleID that it is linked with aria-labelledby
titleTextstringfalseYou can specify titleText that it is linked with aria-label
requiredbooleanfalseYou can specify required that it is linked with aria-required

If you want to know more about accessibility, you can check here.

Accessibility for this package

  • Support aria-* and role options
  • Support keyboard operation
1.5.2

5 months ago

1.5.1

5 months ago

1.5.0

5 months ago

1.4.9

5 months ago

1.4.8

5 months ago

1.4.7

5 months ago

1.4.6

5 months ago

1.4.5

5 months ago

1.4.4

5 months ago

1.4.3

5 months ago

1.4.2

5 months ago

1.4.1

5 months ago

1.2.0

5 months ago

1.3.0

5 months ago