1.3.0 • Published 5 months ago

@illa-design/cascader v1.3.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 months 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

5 months ago

1.3.0

5 months ago

1.0.29

10 months ago

1.0.28

10 months ago

1.0.27

11 months ago

1.0.31

9 months ago

1.0.30

10 months ago

1.1.0

8 months ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.26

12 months ago

1.0.25

12 months ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.20

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

2 years ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.13

1 year ago

1.0.12

1 year 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

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago