@mx-cartographer/categories
v4.0.2
Published
Package containing category selector
Downloads
653
Maintainers
Keywords
Readme
Category Selector Library
This library contains the Category Selector control
Getting started
Installation
- npm install @mx-cartographer/categories
Usage
CategorySelector
must be wrapped by CategoryDataProvider
in order for it to have access to the CategoryStore
import { ApiEndpoints, CategoryApi, CategoryStore } from '@mx-cartographer/common'
import { CategoryDataProvider, CategorySelector } from '@mx-cartographer/categories'
export const Example = () => {
const store = new CategoryStore()
store.initialize(new CategoryApi('/', ''))
const handleSelected = (guid: string) => {
// Some action when category is selected
}
return (
<CategoryDataProvider onEvent={handleEvent} onSelected={handleSelected} store={store}>
<CategorySelector />
</CategoryDataProvider>
)
}
Optional Props
initialSelected: string
Set an initially selected categoryshowSelected: boolean
Whether or not a checkmark should display on selected categoriesunselectable: string[]
An array of category guids that should not be selectableunselectableText: string
Specify what text to show on the tag displayed on unselectable rows (Default is 'Unselectable')