1.3.0 • Published 1 year ago

@illa-design/cascader v1.3.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

Cascader

Cascader is a selector which displays options in multilevel list.

Installation

yarn add @illa-design/cascader

Import component

import { Cascader } from "@illa-design/cascader"

API

Cascader Basic Properties

PropsDescTypeDefault
placeholderSet placeholderstring-
showSearchWhether allow searchboolean | { retainInputValue?: boolean; retainInputValueWhileSelect?: boolean }-
sizeSet selector's size"small" | "medium" | "large""medium"
defaultValueSet defalut value in input(string | string[])[]-
valueSet value(string | string[])[]-
optionsGenerate optionsOptionProps[]-
expandTriggerSet interaction type for expanding netx level list"click" | "hover""click"
multipleWhether to allow selecting multiple treeNodesboolean-
notFoundContentSet the content when options is emptyReactNode-
disabledwhether the selector is disabledboolean-
errorwhether the selector is errorboolean-
loadingwhether the selector is loading statusboolean-
allowClearWhether allow clear valuesboolean-
allowCreateWhether allow create new valuesboolean-
maxTagCountSet maxmium number of tags which is selectednumber-
arrowIconSet arrow iconReactNode | null-
removeIconSet remove iconReactNode | null-

Cascader Events

PropsDescTypeDefault
filterOptionFilter data based on entered value(inputValue: string, option: NodeProps<T>) => boolean-
onChangeCallback when value is changed(value: any) => void-
onSearchCallback when search value is changed(inputValue: string) => void-
onClearCallback when clicked clear(visible: boolean) => void-
onVisibleChangeCallback when the visibility of the popup is changed(visible: boolean) => void-
onClickclicks on the drop-down box(e) => void-

OptionProps

OptionProps {
  value?: string;
  label?: string;
  disabled?: boolean;
  children?: OptionProps[];
  isLeaf?: boolean;
}

Example

Basic usage

const options = [
  {
    value: "beijing",
    label: "Beijing",
    children: [
      {
        value: "chaoyang",
        label: "Chaoyang",
        children: [
          {
            value: "datunli",
            label: "Datunli",
          },
        ],
      },
      {
        value: "dongcheng",
        label: "Dongcheng",
      },
      {
        value: "xicheng",
        label: "Xicheng",
        disabled: true,
      },
      {
        value: "haidian",
        label: "Haidian",
      },
      {
        value: "fengtai",
        label: "fengtai",
      },
      {
        value: "shijingshan",
        label: "Shijingshan",
      },
      {
        value: "mentougou",
        label: "Mentougou",
      },
      {
        value: "fangshan",
        label: "Fangshan",
      },
      {
        value: "tongzhou",
        label: "Tongzhou",
      },
      {
        value: "shunyi",
        label: "Shunyi",
      },
    ],
  },
  {
    value: "shanghai",
    label: "Shanghai",
    children: [
      {
        value: "shanghaishi",
        label: "Shanghai",
        children: [
          {
            value: "huangpu",
            label: "Huangpu",
          },
        ],
      },
    ],
  },
  {
    value: "guangdong",
    label: "Guangdong",
    children: [
      {
        value: "shenzhen",
        label: "Shenzhen",
        children: [
          {
            value: "nanshan",
            label:"Nanshan",
          },
        ],
      },
    ],
  },
]
<Cascader style={{ width: 280 }} multiple options={options} />
1.2.0

1 year ago

1.3.0

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

2 years ago

1.0.31

1 year ago

1.0.30

1 year ago

1.1.0

1 year ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.20

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

3 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago