IChatRenderProps interface
đ Descriptionâ
Interface that specifies the props for the block renderer. Used when creating custom blocks.
đ Type declarationâ
interface IChatRenderProps { id: string;Readonly l10n: L10n.Namespace;Readonly styles: IChatStyles;Readonly attachments: IRunnerAttachments | undefined;Readonly view: "live" | "test" | "preview";Readonly name: JSX.Element | undefined;Readonly description: JSX.Element | undefined;Readonly explanation: JSX.Element | undefined;Readonly label: JSX.Element | undefined;Readonly placeholder: string;Readonly submitLabel: string;Readonly isFailed: boolean;Readonly ariaDescribedBy: string | undefined;Readonly ariaDescription: JSX.Element | undefined;Readonly focus: (e: FocusEvent) => void;Function blur: (e: FocusEvent) => void;Function autoFocus: (element: HTMLElement | null) => void;Function markdownifyToJSX: (md: string, lineBreaks?: boolean) => JSX.Element;Function markdownifyToURL: (md: string) => string;Function markdownifyToImage: (md: string) => string;Function markdownifyToString: (md: string) => string;Function }
đī¸ Propertiesâ
đˇī¸ ariaDescribedByâ
Contains a aria-describedby identifier when there is an ariaDescription set for the block.
Typeâ
string
đˇī¸ ariaDescriptionâ
Contains an automatic generated aria description for the elements labeled with the ariaDescribedBy identifier.
Typeâ
JSX.Element | undefined
đˇī¸ attachmentsâ
Reference to the attachments handler for processing file uploads.
Typeâ
Have a look at the Handling file uploads guide to learn how to use this feature.
đˇī¸ descriptionâ
Contains the description of the block as a JSX.Element. Any markdown used in the description is already processed. Most blocks implement this property and store the description of the block in it.
Typeâ
JSX.Element | undefined
đˇī¸ explanationâ
Contains the explanation of the block as a JSX.Element. Any markdown used in the explanation is already processed. Most blocks implement this property and store the explanation of the block in it.
Typeâ
JSX.Element | undefined
đˇī¸ idâ
Contains a unique id (key) for the block.
Typeâ
string
đˇī¸ isFailedâ
Contains if the block validation has failed.
Typeâ
boolean
đˇī¸ l10nâ
Contains a reference to the l10n (translation) namespace. This namespace contains the gettext functions for translating text.
Typeâ
Exampleâ
l10n._("Text to be translated");
l10n._n("1 car", "%1 cars", 10);
đˇī¸ labelâ
Contains the label of the block as a JSX.Element. Any markdown used in the label is already processed.
Typeâ
JSX.Element | undefined
đˇī¸ nameâ
Contains the name of the block as a JSX.Element. Any markdown used in the name is already processed. Most blocks implement this property and store the name or title of the block in it.
Typeâ
JSX.Element | undefined
đˇī¸ placeholderâ
Contains the placeholder of the block.
Typeâ
string
đˇī¸ stylesâ
Reference to the styles of the runner.
Typeâ
đˇī¸ submitLabelâ
Translated label for the submit button. The submit button is shown in the input area of the block.
Typeâ
string
đˇī¸ viewâ
Contains the current view mode of the runner. It can be one of the following values:
live: The form is running in normal (production) mode;test: The form is running in test mode;preview: The form is running in preview mode.
Typeâ
"live" | "test" | "preview"
âļī¸ Functionsâ
đ§ autoFocusâ
This function should be invoked to indicate that an element is able to receive auto focus. A reference to the element should be provided.
Signatureâ
(element: HTMLElement | null) => void
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
element | HTMLElement | undefined | No | Reference to an element that is able to gain input focus. |
đ§ blurâ
This function should be invoked to indicate that an element in the block lost focus. This is usually attached to the blur event of input elements used in the block.
Signatureâ
(e: FocusEvent) => void
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
e | FocusEvent | No | Reference to the event interface. |
đ§ focusâ
This function should be invoked to indicate that an element in the block gained focus. This is usually attached to the focus event of input elements used in the block.
Signatureâ
(e: FocusEvent) => void
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
e | FocusEvent | No | Reference to the event interface. |
đ§ markdownifyToImageâ
Parses a markdown string to a valid image URL.
Signatureâ
(md: string) => string
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
md | string | No | Specifies the markdown string to process. |
Return valueâ
Returns the image URL.
đ§ markdownifyToJSXâ
Parses a markdown string to formatted JSX.
Signatureâ
(md: string, lineBreaks?: boolean) => JSX.Element
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
md | string | No | Specifies the markdown string to process. |
lineBreaks | boolean | Yes | Specifies if line breaks are supported or not (default is true). |
Return valueâ
Returns the markdown JSX.Element.
đ§ markdownifyToStringâ
Parses a markdown string to a plain string.
Signatureâ
(md: string) => string
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
md | string | No | Specifies the markdown string to process. |
Return valueâ
Returns the parsed string.
đ§ markdownifyToURLâ
Parses a markdown string to a valid URL.
Signatureâ
(md: string) => string
Parametersâ
| Name | Type | Optional | Description |
|---|---|---|---|
md | string | No | Specifies the markdown string to process. |
Return valueâ
Returns the parsed URL.