Suggestion
Suggestion
A suggestion component for chat.
Importimport { Suggestion } from "@ant-design/x"; |
Sourcecomponents/suggestion |
Docs |
Importimport { Suggestion } from "@ant-design/x"; |
Sourcecomponents/suggestion |
Docs |
Common props ref:Common props
For more configuration, please check CascaderProps
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| block | Take up the full width | boolean | false | - |
| children | Custom input box | ({ onTrigger, onKeyDown }) => ReactElement | - | - |
| items | Suggestion list | SuggestionItem[] | ((info: T) => SuggestionItem[]) | - | - |
| open | Controlled open panel | boolean | - | - |
| rootClassName | Root element class name | string | - | - |
| onSelect | Callback when the suggestion item is selected | (value: string, selectedOptions: SuggestionItem[]) => void; | - | - |
| onOpenChange | Callback when the panel open state changes | (open: boolean) => void | - | - |
| getPopupContainer | The parent node of the menu. Default is to render to body. If you encounter menu scrolling positioning issues, try modifying it to the scrolling area and positioning relative to it | (triggerNode: HTMLElement) => HTMLElement | () => document.body | - |
type onTrigger<T> = (info: T | false) => void;
Suggestion accepts generics to customize the parameter type passed to items renderProps. When false is passed, the suggestion panel is closed.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| children | Child item for the suggestion item | SuggestionItem[] | - | - |
| extra | Extra content for the suggestion item | ReactNode | - | - |
| icon | Icon for the suggestion | ReactNode | - | - |
| label | Content to display for the suggestion | ReactNode | - | - |
| value | Value of the suggestion item | string | - | - |