@wyesoftware/cascader
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Cascader

Cascader Component for React.JS/React.TS

Install package

npm i @wyesoftware/cascader
yarn add @wyesoftware/cascader

Usage

import Cascader from "@wyesoftware/cascader";

const App = () => {
  return <Cascader />;
};

TypeScript

This component has full typescript support.

Available props

Property Description Type Default Required
dir Direction of the component "ltr" / "rtl" "ltr" false
dirFromElement Set component direction from outside element "html" / "body" / string (for id) - false
inputRef Ref for input Ref - false
name Form name string - false
value The input content value string / number / undefined - false
placeholder Custom input placeholder string - false
onChange Callback when user input (value: string / number / undefined) => void - false
onBlur Callback when user click outside (e?: FocusEvent) => void - false
options Cascader options Array (see example) - true
disabled Set input disabled mode boolean false false
readOnly Set input readOnly mode boolean false false
allowClear Show clear input button boolean false false
onClear Callback when user clear input () => void - false
className Set classes for main container string - false

Options example

const options = [
  {
    label: "Test",
    value: 123,
    children: [
      {
        label: "Test in test",
        value: 456,
        children: [
          {
            label: "Test in test in test",
            value: 789,
          },
        ],
      },
    ],
  },
  {
    label: "Test1",
    value: 987,
    children: [
      {
        label: "Test in test1",
        value: 654,
      },
    ],
  },
  {
    label: "Test2",
    value: 321,
  },
];

Future updates

More features....

Package Sidebar

Install

npm i @wyesoftware/cascader

Weekly Downloads

9

Version

0.1.5

License

ISC

Unpacked Size

32.9 kB

Total Files

12

Last publish

Collaborators

  • shadoworion