# MentionProps (@salmonui/dropdowns/mention)

> The MentionProps interface of @salmonui/dropdowns/mention.

Canonical: https://salmonui.dev/docs/reference/dropdowns/mention/MentionProps

```ts
import type { MentionProps } from '@salmonui/dropdowns/mention';
```

Entry index: https://salmonui.dev/docs/reference/dropdowns/mention (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/dropdowns/mention.md).

## Reference

Kind: interface

```ts
interface MentionProps<T = MentionItem> {
    readonly children?: ReactNode;
    readonly target?: RefObject<HTMLTextAreaElement | HTMLInputElement | null>;
    readonly editor?: MentionEditorTarget | null;
    readonly data?: MentionData<T>;
    readonly triggers?: readonly MentionTrigger<T>[];
    readonly requireLeadingSpace?: boolean;
    readonly multiWord?: boolean;
    readonly minSearchLength?: number;
    readonly maxResults?: number;
    readonly searchOperator?: MentionSearchOperator<T>;
    readonly matchCase?: boolean;
    readonly ignoreAccents?: boolean;
    readonly searchFields?: readonly string[];
    readonly debounce?: number;
    readonly highlightMatches?: boolean;
    readonly getItemValue?: (item: T) => string | number;
    readonly getItemLabel?: (item: T) => string;
    readonly isItemDisabled?: (item: T) => boolean;
    readonly getInsertText?: (item: T, trigger: MentionTrigger<T>) => string;
    readonly onBeforeInsert?: (event: MentionBeforeInsertEvent<T>) => void;
    readonly onInsert?: (event: MentionInsertEvent<T>) => void;
    readonly onOpenChange?: (open: boolean, event: MentionOpenChangeEvent) => void;
    readonly onSearchChange?: (event: MentionSearchChangeEvent) => void;
    readonly onLoadError?: (error: unknown) => void;
    readonly renderItem?: (context: MentionRenderItemContext<T>) => ReactNode;
    readonly renderEmpty?: () => ReactNode;
    readonly renderLoading?: () => ReactNode;
    readonly renderError?: (context: {
        readonly error: unknown;
    }) => ReactNode;
    readonly localeText?: Partial<MentionLocaleText>;
    readonly container?: Element | null;
    readonly className?: string;
    readonly style?: CSSProperties;
    readonly classNames?: Partial<Record<MentionPart, string>>;
    readonly styles?: Partial<Record<MentionPart, CSSProperties>>;
    readonly ref?: Ref<HTMLDivElement>;
}
```

Members (35):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | One `<textarea>` or `<input>` (possibly nested in other markup). Omit it and pass `target` instead. |
| `target` | `readonly target?: RefObject<HTMLTextAreaElement \| HTMLInputElement \| null>;` | optional | The field to attach to when it is not a child. |
| `editor` | `readonly editor?: MentionEditorTarget \| null;` | optional | A `contenteditable` surface to attach to instead of a field: the result of `createContentEditableMentionTarget(element)` or the target a rich text editor provides. Keep it stable across renders; it wins over `target` and children fields. |
| `data` | `readonly data?: MentionData<T>;` | optional | Suggestions for triggers without their own `data`. |
| `triggers` | `readonly triggers?: readonly MentionTrigger<T>[];` | optional | Trigger characters, each with optional own data (default `[{ char: '@' }]`). |
| `requireLeadingSpace` | `readonly requireLeadingSpace?: boolean;` | optional | A trigger only counts at the start or after whitespace (default `true`). |
| `multiWord` | `readonly multiWord?: boolean;` | optional | The search text may contain spaces. |
| `minSearchLength` | `readonly minSearchLength?: number;` | optional | Characters typed after the trigger before the list opens. |
| `maxResults` | `readonly maxResults?: number;` | optional | Suggestions shown at most. |
| `searchOperator` | `readonly searchOperator?: MentionSearchOperator<T>;` | optional | Default `'contains'`. |
| `matchCase` | `readonly matchCase?: boolean;` | optional |  |
| `ignoreAccents` | `readonly ignoreAccents?: boolean;` | optional |  |
| `searchFields` | `readonly searchFields?: readonly string[];` | optional | Fields a remote source searches (default `['label']`). |
| `debounce` | `readonly debounce?: number;` | optional | Delay in ms before a remote read (default 300); local data filters on every keystroke. |
| `highlightMatches` | `readonly highlightMatches?: boolean;` | optional | Mark the matched text in each suggestion (`<mark>`). |
| `getItemValue` | `readonly getItemValue?: (item: T) => string \| number;` | optional |  |
| `getItemLabel` | `readonly getItemLabel?: (item: T) => string;` | optional |  |
| `isItemDisabled` | `readonly isItemDisabled?: (item: T) => boolean;` | optional |  |
| `getInsertText` | `readonly getInsertText?: (item: T, trigger: MentionTrigger<T>) => string;` | optional | Text inserted for an item (default its label). |
| `onBeforeInsert` | `readonly onBeforeInsert?: (event: MentionBeforeInsertEvent<T>) => void;` | optional |  |
| `onInsert` | `readonly onInsert?: (event: MentionInsertEvent<T>) => void;` | optional |  |
| `onOpenChange` | `readonly onOpenChange?: (open: boolean, event: MentionOpenChangeEvent) => void;` | optional |  |
| `onSearchChange` | `readonly onSearchChange?: (event: MentionSearchChangeEvent) => void;` | optional |  |
| `onLoadError` | `readonly onLoadError?: (error: unknown) => void;` | optional |  |
| `renderItem` | `readonly renderItem?: (context: MentionRenderItemContext<T>) => ReactNode;` | optional |  |
| `renderEmpty` | `readonly renderEmpty?: () => ReactNode;` | optional |  |
| `renderLoading` | `readonly renderLoading?: () => ReactNode;` | optional |  |
| `renderError` | `readonly renderError?: (context: {     readonly error: unknown; }) => ReactNode;` | optional |  |
| `localeText` | `readonly localeText?: Partial<MentionLocaleText>;` | optional |  |
| `container` | `readonly container?: Element \| null;` | optional | Portal container of the popup (default the field's closest theme scope, else `document.body`). |
| `className` | `readonly className?: string;` | optional |  |
| `style` | `readonly style?: CSSProperties;` | optional |  |
| `classNames` | `readonly classNames?: Partial<Record<MentionPart, string>>;` | optional |  |
| `styles` | `readonly styles?: Partial<Record<MentionPart, CSSProperties>>;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement>;` | optional | The root `<div>` that wraps `children`. |
