@kadconsulting/dry
Version:
KAD Reusable Component Library
38 lines (37 loc) • 1.23 kB
TypeScript
import type { ChangeEvent } from 'react';
/**
* Represents an option in the dropdown select.
*/
export interface DropdownOption {
/** The text displayed for this option */
label: string;
/** The value associated with this option */
value: string;
}
/**
* Props for the DropdownSelect component.
*/
export interface DropdownSelectProps extends React.HTMLAttributes<HTMLElement> {
/** The name attribute for the select element */
name: string;
/** The currently selected value */
value: string;
/** An array of options to display in the dropdown */
options: DropdownOption[];
/** Callback function triggered when the selection changes */
onChange: (e: ChangeEvent<HTMLSelectElement>) => void;
/** Additional CSS class names */
className?: string;
/** Label text for the dropdown */
label?: string;
/** Whether the dropdown is visible */
isVisible?: boolean;
/** Whether the dropdown is in a loading state */
isLoading?: boolean;
/** The width of the dropdown */
width?: string;
/** Support for @testing-library/react `screen.getByTestId` */
'data-testid'?: string;
/** Whether the dropdown is disabled */
disabled?: boolean;
}