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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cloud-ru/ds-uikit-product-config-selector

v1.0.4

Published

Chip-toggle для выбора одной опции конфигурации — кликабельный chip с состояниями checked / available / disabled и tooltip-подсказками.

Readme

ConfigSelector

@cloud-ru/ds-uikit-product-config-selector — Chip-toggle для выбора одной опции конфигурации — кликабельный chip с состояниями checked / available / disabled и tooltip-подсказками.

Chip-toggle для выбора опции конфигурации. Под капотом — скрытый <input type=checkbox> в <label>: chip кликабелен целиком, поддерживает фокус с клавиатуры и tooltip-подсказки. Компонент controlled — состояние checked хранится снаружи.

Когда использовать

  • Выбор одного значения из набора equal-weight опций конфигурации (тариф, размер инстанса, регион), когда их удобно показать рядом как chips.
  • Когда у опции нужно подсветить «рекомендованность» (available) или объяснить недоступность (disabled) через tooltip.

Когда не нужен ConfigSelector:

  • Бинарная настройка с заголовком и описанием:
    • используйте SwitchRow.
  • Множественный выбор тегов/фильтров:
    • используйте Chip / Tag.

Анатомия

Состояния

  • checked — выбранная опция: светло-зелёный tint (activated state-layer), accent-обводка, тёмно-зелёный текст. Управляется через checked + onChange(checked, e).
  • available — accent-обводка для рекомендуемой опции. Опционально availableTip — tooltip, который показывается, пока опция не выбрана.
  • disabled — клики игнорируются. Опционально disabledTip — tooltip-объяснение.

Слоты

  • label — обязательный текст chip. Длинный лейбл обрезается многоточием.

Установка

pnpm add @cloud-ru/ds-uikit-product-config-selector
import { ConfigSelector } from '@cloud-ru/ds-uikit-product-config-selector'

Примеры использования

Базовый ConfigSelector

import { ConfigSelector } from '@cloud-ru/ds-uikit-product-config-selector';
import { useState } from 'react';

export function Basic() {
  const [checked, setChecked] = useState(false);

  return <ConfigSelector label='Авторазвёртывание' checked={checked} onChange={setChecked} />;
}

Рекомендуемая опция (available + tooltip)

import { PortalContextProvider } from '@cloud-ru/ds-portal-context';
import { ConfigSelector } from '@cloud-ru/ds-uikit-product-config-selector';
import { useState } from 'react';

export function Available() {
  const [checked, setChecked] = useState(false);

  return (
    <PortalContextProvider>
      <ConfigSelector
        label='Рекомендуемый тариф'
        available
        availableTip='Подходит для большинства проектов'
        checked={checked}
        onChange={setChecked}
      />
    </PortalContextProvider>
  );
}

Disabled с tooltip-объяснением

import { PortalContextProvider } from '@cloud-ru/ds-portal-context';
import { ConfigSelector } from '@cloud-ru/ds-uikit-product-config-selector';
import { useState } from 'react';

export function Disabled() {
  const [checked, setChecked] = useState(false);

  return (
    <PortalContextProvider>
      <ConfigSelector
        label='Премиум-конфигурация'
        disabled
        disabledTip='Недоступно на текущем тарифе'
        checked={checked}
        onChange={setChecked}
      />
    </PortalContextProvider>
  );
}

Группа с single-select

Несколько chip’ов, где выбран ровно один.

import { ConfigSelector } from '@cloud-ru/ds-uikit-product-config-selector';
import { useState } from 'react';

const OPTIONS = ['nano', 'micro', 'standard', 'large'] as const;

export function Group() {
  const [selected, setSelected] = useState<(typeof OPTIONS)[number]>('micro');

  return (
    <div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center' }}>
      {OPTIONS.map(option => (
        <ConfigSelector
          key={option}
          label={option}
          checked={selected === option}
          onChange={() => setSelected(option)}
        />
      ))}
    </div>
  );
}

Props

ConfigSelectorProps

| Prop | Type | Default | Description | |------|------|---------|-------------| | available | boolean | — | Доступна ли опция | | availableTip | ReactNode | — | Тултип для доступной опции | | checked | boolean | — | Отмечен ли компонент | | className | string | — | CSS-класс | | data-test-id | string | — | | | disabled | boolean | — | Деактивирован ли компонент | | disabledTip | ReactNode | — | Тултип для деактивированного компонента | | label | string | — | Лейбл | | onChange | (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void | — | Колбек смены значения | | tabIndex | number | 0 | HTML tab index |

Доступность

Компонент основан на скрытом checkbox — это корректно для одиночного toggle (независимое вкл/выкл).

Для группового single-select (несколько ConfigSelector с checked ровно у одного, см. пример «Группа с single-select») семантика остаётся checkbox: скринридер озвучивает каждый chip как «checkbox» без контекста «1 из N». Checkbox-семантика выбрана осознанно — компонент переиспользуется в обоих сценариях и не навязывает radio-группу.

Если групповой контекст для скринридера обязателен, набор chip оборачивается в контейнер с role='radiogroup' и доступным именем (aria-label / aria-labelledby); ARIA-роль элементов при этом остаётся на стороне потребителя.