Events in React Inline AI Assist

11 Aug 20266 minutes to read

This section describes the Inline AI Assist events that will be triggered when appropriate actions are performed. The following events are available in the Inline AI Assist component.

created

The Inline AI Assist component triggers the created event when the component rendering is completed.

import { InlineAIAssistComponent } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handleCreated = () => {
        // Your actions here
    }

    return (
        <InlineAIAssistComponent created={handleCreated} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));
import { InlineAIAssistComponent } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handleCreated = () => {
        // Your actions here
    }

    return (
        <InlineAIAssistComponent created={handleCreated} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));

promptRequest

The promptRequest event is triggered when the prompt request is made in the Inline AI Assist component.

import { InlineAIAssistComponent } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handlePromptRequest = (args) => {
        // Your actions here
    }

    return (
        <InlineAIAssistComponent promptRequest={handlePromptRequest} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));
import { InlineAIAssistComponent, InlinePromptRequestEventArgs } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handlePromptRequest = (args: InlinePromptRequestEventArgs) => {
        // Your actions here
    }

    return (
        <InlineAIAssistComponent promptRequest={handlePromptRequest} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));

open

The open event is triggered when the Inline AI Assist popup is opened.

import { InlineAIAssistComponent } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handlePopupOpen = (args) => {
        // Your actions here when popup opens
    }

    return (
        <InlineAIAssistComponent open={handlePopupOpen} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));
import { InlineAIAssistComponent } from '@syncfusion/ej2-react-interactive-chat';
import { OpenEventArgs } from '@syncfusion/ej2-popups';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handlePopupOpen = (args: OpenEventArgs) => {
        // Your actions here when popup opens
    }

    return (
        <InlineAIAssistComponent open={handlePopupOpen} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));

close

The close event is triggered when the Inline AI Assist popup is closed.

import { InlineAIAssistComponent } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handlePopupClose = (args) => {
        // Your actions here when popup closes
    }

    return (
        <InlineAIAssistComponent close={handlePopupClose} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));
import { InlineAIAssistComponent } from '@syncfusion/ej2-react-interactive-chat';
import { CloseEventArgs } from '@syncfusion/ej2-popups';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

function App() {

    const handlePopupClose = (args: CloseEventArgs) => {
        // Your actions here when popup closes
    }

    return (
        <InlineAIAssistComponent close={handlePopupClose} />
    );
}

ReactDOM.render(<App />, document.getElementById('container'));