0.13.0 • Published 4 years ago

@pndr/multiple-select-field v0.13.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

MultipleSelectField MultipleSelectField

npm package

Used for selecting multiple options from a list.

Getting started

npm install @cmds/multiple-select-field --save
<MultipleSelectField
    id={'fld1'}
    contextId={'recordGalleryCard'}
    roleId={'readOnly'}
    optionIds={['opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6']}
    options={{
        coloredOptions: true,
        options: ['opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6'],
        optionsById: {
            'opt1': {
                id: 'opt1',
                colorId: 'blue.base',
                name: 'Blue'
            },
            'opt2': {
                id: 'opt2',
                colorId: 'green.base',
                name: 'Green'
            },
            'opt3': {
                id: 'opt3',
                colorId: 'red.base',
                name: 'Red'
            },
            'opt4': {
                id: 'opt4',
                colorId: 'yellow.base',
                name: 'Yellow'
            },
            'opt5': {
                id: 'opt5',
                colorId: 'indigo.base',
                name: 'Indigo'
            },
            'opt6': {
                id: 'opt6',
                colorId: 'purple.base',
                name: 'Purple'
            }
        }
    }}
/>

Prop Types

PropertyTypeRequired?Description
idStringUnique id for the instance of this field
contextIdContextThe appearance will change depending on context in which the field is displayed. Valid options include: recordDetail or recordGridRow or recordGalleryCard or recordListItem
roleIdRoleThe behaviour changes based on the role. Valid options include editor or readOnly
optionsObjectObject that holds each option by it's id. Each option should have an id, name, colorId (optional)
optionOrderArrayShould reference all options in the preferred order
coloredOptionsBooleanEnables coloring for options
optionIdsArrayList of selected options
onLinkFunctionCallback invoked whenever an option get's added to the selection: ({id: string, optionId: string}): void
onUnlinkFunctionCallback invoked whenever an option get's removed from the selection: ({id: string, optionId: string}): void
onClearFunctionCallback invoked whenever all options get deselected: ({id: string}): void
onSortFunctionCallback invoked whenever one of the selected options get's sorted: ({id: string, optionId: string, targetIndex: number}): void

More information

This component is designed and developed as part of Cosmos Design System.

0.13.0

4 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.0

5 years ago