npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@synerise/ds-context-selector

v0.25.23

Published

ContextSelector UI Component for the Synerise Design System

Downloads

468

Readme


id: context-selector title: ContextSelector

ContextSelector UI Component

Installation

npm i @synerise/ds-context-selector
or
yarn add @synerise/ds-context-selector

Usage

import ContextSelector from '@synerise/ds-context-selector'

<ContextSelector
    texts={{
     buttonLabel: 'Choose',
     searchPlaceholder: 'Search',
     noResults: 'No results',
   }}
    onSelectItem={(item) => {}}
    selectedItem={{
       name: 'Transaction charge',
       id: 6,
       icon: <NotificationsM />,
       groupId: 'RECENT',
       groupName: 'Activity',
     }}
    items={[
        {
            name: 'Pricelist 02',
            id: 0,
            icon: <SegmentM />,
            groupId: 'RECENT',
            groupName: 'Parameters',
        },
        {
            name: 'Transaction charge',
            id: 6,
            icon: <NotificationsM />,
            groupId: 'RECENT',
            groupName: 'Activity',
        },
        {
          name: 'Segmentation 1',
          id: 'segmentation_1',
          icon: <SegmentM />,
          groupId: 'SEGMENTATIONS',
        }
    ]}
    groups={[
        {
            id: 'RECENT',
            name: 'Recent',
            defaultGroup: true,
          },
          {
            id: 'ALL',
            name: 'All',
            defaultGroup: false,
            subGroups: [
            {
                name: 'Segmentations',
                id: 'SEGMENTATIONS',
                icon: <FolderM />,
                groupName: 'Parameters',
            },
            ]
        }]}
/>

Demo

API

| Property | Description | Type | Default | | --- | --- | --- | --- | | groups | Groups of items | ContextGroup[] | [] | | items | Array of items | ContextItem[] | [] | | menuItemHeight | Size of single menu item | ItemSize.LARGE \ ItemSize.DEFAULT | ItemSize.DEFAULT | | onSelectItem | Callback called when user selects item | (item: ContextItem \ ContextGroup \ undefined) => void | - | | defaultDropdownVisibility | default visibility of dropdown | boolean | false | | opened | Whether if dropdown should opens from outside of component | boolean | false | | texts | Translations object | ContextTexts | - | | selectedItem | Selected item | ContextItem \ undefined | undefined | | addMode | If true trigger doesn't change style when value is set | ContextItem \ undefined | undefined | | customTriggerComponent | Add custom trigger | React.ReactNode | undefined | | trigger | Add custom trigger to modal | 'click' \ 'hover' \ 'contextMenu' | 'click | | getMenuEntryProps | Configure tooltip (information-card by default) | (arg: ParameterValueType) => MenuItemProps \ undefined | undefined | | dropdownWrapperStyles | Apply custom styles to dropdown wrapper | CSSProperties \ undefined | - | | onClickOutsideEvents | Overwrite default events for document listener | HandledEventsType[] \ undefined | - | | onClickOutside | Callback called when user click outside dropdown | () => void \ undefined | - | | onSearch | Callback called when user enter any char in search input | (query: string) => void | - | | hideSearchField | Whether to hide the search field in the dropdown | boolean | false | | onFetchData | Callback called when user scrolls to the end of dropdown list | () => void | - | | onActivate | Callback called when user opens dropdown | (fieldType: string) => void | - | | onDeactivate | Callback called when user closes dropdown | () => void | - | | hasMoreItems | Whether if onFetchData should be called | boolean | - | | getPopupContainerOverride | Popup container function for child tooltips and dropdowns | (trigger: HTMLElement | null) => HTMLElement; | - | | dropdownProps | Limited part of props for dropdown on ContextSelector component | Omit<DropdownProps, 'trigger' 'getPopupContainer' 'onVisibleChange' 'visible' 'overlay'> | - |

ContextGroup

| Property | Description | Type | Default | | --- | --- | --- | --- | | defaultGroup | Whether if this group is default | boolean | false | | icon | Icon of group | React.ReactNode | - | | id | Id of group | React.ReactText | - | | itemType | Type of items | string | - | | name | Name of group | string | - | | subGroups | Subgroups of groups | ContextGroup[] | - | | tooltip | Tooltip text | string | - | | useCustomIcon | Use custom icon instead of wrapping it inside Icon component | boolean | false | | description | Set menu item description ( recommended to use with 'large' size | React.ReactNode | - | | customSuffix | Use custom suffix instead of default 'check' icon | React.ReactNode | - |

ContextItem

| Property | Description | Type | Default | | --- | --- | --- | --- | | groupId | Id of group | React.ReactText | - | | groupName | Name of group | string | - | | icon | Icon of item | React.ReactNode | - | | id | Id of item | React.ReactText | - | | name | Name of item | string | - | | subGroups | Subgroups of item | ContextGroup[] | - | | useCustomIcon | Use custom icon instead of wrapping it inside Icon component | boolean | false | | description | Set menu item description ( recommended to use with 'large' size | React.ReactNode | - | | customSuffix | Use custom suffix instead of default 'check' icon | React.ReactNode | - |

ContextTexts

| Property | Description | Type | Default | |----------------------|-------------------------------------------|-----------|--------------| | buttonLabel | Button label | ReactNode | 'Choose' | | noResults | No results info | ReactNode | 'No results' | | searchPlaceholder | Search box placeholder | string | 'Search' | | showMore | Show more button label | ReactNode | 'Show more' | | recentItemsGroupName | Dropdown section title for recent results | string | 'Recent' | | allItemsGroupName | Dropdown section title for all results | string | 'All' |