reablocks
Version:
Component library for React
48 lines (46 loc) • 1.2 kB
TypeScript
import { CommandPaletteTheme } from '../CommandPaletteTheme';
import { HotkeyIem } from '../useFlattenedTree';
import { FC, KeyboardEvent, FocusEvent, ReactNode } from 'react';
export interface CommandPaletteInputProps {
/**
* The value of the input.
*/
value: string;
/**
* Placeholder text.
*/
placeholder?: string;
/**
* Autofocus or not.
*/
autoFocus?: boolean;
/**
* Icon to show in the search input.
*/
icon?: ReactNode;
/**
* Hotkeys set by CommandPalette from useFlattenedTree.
*/
hotkeys: HotkeyIem[];
/**
* When the search input value changes.
*/
onChange: (value: string) => void;
/**
* When a user presses a key.
*/
onKeyPress: (event: KeyboardEvent<HTMLInputElement>) => void;
/**
* When the input loses focus.
*/
onBlur: (event: FocusEvent<HTMLInputElement>) => void;
/**
* When a hotkey was triggered. Used internally.
*/
onHotkey: (hotkey: HotkeyIem) => void;
/**
* Theme for the Command Palette.
*/
theme?: CommandPaletteTheme;
}
export declare const CommandPaletteInput: FC<CommandPaletteInputProps>;