# ChatWidget class

> The ChatWidget class of Novior.MentorAgent.Abstractions.Components. Part of the Novior.MentorAgent.Abstractions package.

- URL: https://docs.mentoragent.net/api/novior-mentoragent-abstractions-components/chatwidget
- Verified with: MentorAgent 1.2.0
- Last updated: 2026-10-27
- Packages: Novior.MentorAgent.Abstractions

## Definition

Namespace: `Novior.MentorAgent.Abstractions.Components`. Package: `Novior.MentorAgent.Abstractions`.

`public class ChatWidget : ComponentBase, IDisposable`

```shell
dotnet add package Novior.MentorAgent.Abstractions
```

## Constructors

`public ChatWidget()`

## Properties

### `CardTemplate`

`public RenderFragment<MentorCard>? CardTemplate { get; set; }`

Optional custom renderer for generative cards (\#14 L2). When set it replaces `MentorCardView` for **every** card, so switch on `card.Kind` inside it and fall back to `<MentorCardView />` for the kinds you do not handle:

```text title="Example"
<ChatWidget>
    <CardTemplate Context="card">
        @if (card.Kind == "order") { <OrderCard Card="card" /> }
        else                       { <MentorCardView Card="card" /> }
    </CardTemplate>
</ChatWidget>
```

### `Language`

`public MentorLanguage? Language { get; set; }`

The language of this widget, for this page: its texts, the voice, the tour, and every turn it sends, which the assistant answers in. `null` (the default) means `MentorOptions.Language`. Bind it to the page's language and the widget follows a change at once, keeping the conversation:

```text title="Example"
<ChatWidget Language="@_language" />
```

## Methods

### `Dispose`

`public void Dispose()`

---

- Previous: [ChatInput class](https://docs.mentoragent.net/api/novior-mentoragent-abstractions-components/chatinput.md)
- Next: [ConfirmationBanner class](https://docs.mentoragent.net/api/novior-mentoragent-abstractions-components/confirmationbanner.md)
