Skip to main content

Input

v.1.0.6

Installation

yarn add @mercell/input-dropdown-react

Usage

Using the Input dropdown component is as simple as importing it like this.

import { InputDropdown } from '@mercell/input-dropdown-react';
Live Editor
Result

Types, definitions, etc.

InputDropdownProps
export interface InputDropdownProps {
onChangeInputDropdown: (
inputValue: string,
dropdownValue: DropdownProps['value']
) => void;
selectedOptions: DropdownProps['value'];
pinnedOptions?: DropdownProps['options'];
inputValue: string;
dropdownSide?: 'left' | 'right';
dropdownOptions: DropdownProps['options'];
inputProps?: Omit<JSX.IntrinsicElements['input'], 'ref'> &
MutableRefObject<HTMLInputElement>;
inputElementProps?: Omit<JSX.IntrinsicElements['span'], 'ref'> &
MutableRefObject<HTMLSpanElement>;
inputContainerProps?: JSX.IntrinsicElements['div'];
dropdownProps?: Omit<DropdownProps, 'options' | 'value'>;
disabled?: boolean;
invalid?: boolean;
dropdownMaxWidth?: string
}
NameTypeDefaultRequiredDescription
onChangeInputDropdownfunction (inputValue: string, dropdownValue: DropdownProps['value'])-yesThe input and dropdown elements onChange
selectedOptionsDropdownProps['value']nullyesThe selected option in dropdown
pinnedOptionsDropdownProps['options']-noArray of pinned options
inputValuestring''yesThe value in input
dropdownSide'left' | 'right';leftnoWhich side of the input the dropdown should display
dropdownOptionsDropdownProps['options']-yesOptions in the dropdown
inputProps-noProperties for the input
inputElementProps-noProperties for the input element
inputContainerPropsJSX.IntrinsicElements['div']-noProperties for the input container
dropdownPropsOmit<DropdownProps, 'options' | 'value'>-noProperties for the dropdown
disabledbooleanfalsenoSet field disabled
invalidbooleanfalsenoSet field invalid
dropdownMaxWidthstring'170px'noSet max width for dropdown container