You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

antd-multi-cascader

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antd-multi-cascader

A multiple cascader component for antd

1.3.1
latest
Source
npmnpm
Version published
Weekly downloads
419
17.04%
Maintainers
1
Weekly downloads
 
Created
Source

antd-multi-cascader

Test PRs Welcome MIT license Codecov Coverage Storybook npm

A multiple cascader component for antd

antd-multi-cascader

Online DemoHow it works?

demo

How to use?

npm install antd-multi-cascader or yarn add antd-multi-cascader
const [value, setValue] = React.useState<string[]>([]);

return (
  <MultiCascader
    value={value}
    onChange={setValue}
    data={options}
    placeholder="Select Cities"
  />
)

Props

PropsTypeDescription
valuestring[]Selected value
dataTreeNode[]Cascader options TreeNode { title: string, value: string, children?: TreeNode, isLeaf?: boolean }
allowClearbooleanWhether allow clear
placeholderstringThe input placeholder
onChange(newVal) => voidCallback when finishing value select
selectAllbooleanWhether allow select all
classNamebooleanThe additional css class
styleReact.CSSPropertiesThe additional style
disabledbooleanWhether disabled select
okTextstringThe text of the Confirm button
cancelTextstringThe text of the Cancel button
selectAllTextstringThe text of the SelectAll radio
onCascaderChange(node: TreeNode, operations: { add: (children: TreeNode[]) => TreeNode[] }) => voidTrigger when click a menu item
popupTransitionNamestringShould set 'ant-slide-up' manually if antd version greater than 4.13.0
getPopupContainer(props: any) => HTMLElementParent Node which the selector should be rendered to. Default to body. When position issues happen, try to modify it into scrollable content and position it relative
maxTagCountMax tag count to show. responsive will cost render performancenumber | responsive

Async Data Example

const [asyncOptions, setAsyncOptions] = React.useState([
  {
    value: 'ParentNode1',
    title: 'ParentNode1',
    // tell component this node is not a leaf node
    isLeaf: false,
  },
  {
    value: 'ParentNode2',
    title: 'ParentNode2',
  },
])

const handleCascaderChange = React.useCallback((node, { add }) => {
  // call add function to append children nodes
  if (node.value === 'ParentNode1' && !node.children) {
    setTimeout(() => {
      setAsyncOptions(
        add([
          {
            value: 'ParentNode1-1',
            title: 'ParentNode1-1',
          },
        ])
      )
    }, 1000)
  }
}, [])

<MultiCascader
  selectAll
  data={asyncOptions}
  onCascaderChange={handleCascaderChange}
  placeholder="Async Data"
/>

Keywords

antd

FAQs

Package last updated on 09 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts