@mx-cartographer/categories
TypeScript icon, indicating that this package has built-in type declarations

4.0.2 • Public • Published

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 category
  • showSelected: boolean Whether or not a checkmark should display on selected categories
  • unselectable: string[] An array of category guids that should not be selectable
  • unselectableText: string Specify what text to show on the tag displayed on unselectable rows (Default is 'Unselectable')

Dependents (0)

Package Sidebar

Install

npm i @mx-cartographer/categories

Weekly Downloads

66

Version

4.0.2

License

MIT

Unpacked Size

83.6 kB

Total Files

66

Last publish

Collaborators

  • rquant.mx
  • lucas.fleagle
  • matthewstclaire
  • oklandon
  • jgerlach
  • lem_mx
  • igor.morgunov
  • mattcbodily
  • shalyn.huetter123
  • william.bridegroom
  • stephanie.stamm
  • drewwarren
  • stevencreates