ChipDropdown
A dropdown component styled as a chip for space-efficient selection.
Installation
npm install @cleartrip/ct-design-chip-dropdown
# or
pnpm add @cleartrip/ct-design-chip-dropdown
Peer dependencies
# Required for all targets
npm install react
# Web only
npm install react-dom
# React Native only
npm install react-native
Usage
Basic
import { ChipDropdown } from '@cleartrip/ct-design-chip-dropdown';
function Example() {
return (
<ChipDropdown>
{/* Basic usage */}
</ChipDropdown>
);
}
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
width | number | — | Yes | width property |
isDefaultOptionSelected | boolean | — | No | isDefaultOptionSelected property |
defaultChipLabel | string | — | No | defaultChipLabel property |
optionList | DropdownProps['itemList'] | — | Yes | optionList property |
selectedOption | string | — | No | selectedOption property |
showDropdown | boolean | — | No | showDropdown property |
onClick | (key: string) => void | — | No | onClick property |
dropdownHeight | number | — | No | dropdownHeight property |
chipArrowDownIconProps | SVGProps<SVGSVGElement> | — | No | chipArrowDownIconProps property |
styleConfig | IChipDropdownStyleConfig | — | No | styleConfig property |
Accessibility
- The component follows accessibility best practices
- Ensure proper ARIA attributes are provided where needed
- Test with screen readers to ensure usability
Migration
If migrating from a previous version:
- import { ChipDropdown } from 'yagami/core/components';
+ import { ChipDropdown } from '@cleartrip/ct-design-chip-dropdown';