@workday/canvas-kit-labs-react
Version:
Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functi
61 lines • 2.36 kB
TypeScript
import React from 'react';
import { GrowthBehavior } from '@workday/canvas-kit-react/common';
import { TertiaryButtonProps } from '@workday/canvas-kit-react/button';
import { TextInputProps } from '@workday/canvas-kit-react/text-input';
export interface ComboBoxMenuItemGroup {
header: React.ReactElement<any>;
items: React.ReactElement<any>[];
}
export interface ComboboxProps extends GrowthBehavior, React.HTMLAttributes<HTMLElement> {
/**
* The TextInput child of the Combobox.
*/
children: React.ReactElement<TextInputProps>;
/**
* The initial value of the Combobox.
*/
initialValue?: string;
/**
* The variant of the Combobox clear button. The default is a TertiaryButton
*/
clearButtonVariant?: TertiaryButtonProps['variant'];
/**
* If true, render the Combobox with a button to clear the text input.
* @default false
*/
showClearButton?: boolean;
/**
* The `aria-label` for the Combobox clear button.
* @default Reset Search Input
*/
clearButtonAriaLabel?: string;
/**
* The autocomplete items of the Combobox. This array of menu items is shown under the text input.
*/
autocompleteItems?: React.ReactElement<any>[] | ComboBoxMenuItemGroup[];
/**
* The function called when the Combobox text input changes.
*/
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
/**
* The function called when the Combobox text input focuses.
*/
onFocus?: React.FocusEventHandler;
/**
* The function called when the Combobox text input blurs.
*/
onBlur?: React.FocusEventHandler;
/**
* The id of the form field.
*/
labelId?: string;
/**
* The text for screen readers announcing the autocomplete count
*/
getStatusText?: (listCount: number) => string;
}
export declare const listBoxIdPart = "listbox";
export declare const getOptionId: (baseId?: string, index?: number) => string;
export declare const getTextFromElement: (children?: React.ReactNode) => string;
export declare const Combobox: ({ autocompleteItems, children, grow, initialValue, onChange, onFocus, onBlur, showClearButton, clearButtonVariant, clearButtonAriaLabel, labelId, getStatusText, id, ...elemProps }: ComboboxProps) => React.JSX.Element;
//# sourceMappingURL=Combobox.d.ts.map