Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenChat

    RadzenChat component that provides a modern chat interface for multi-participant conversations.

    Inheritance
    object
    ComponentBase
    RadzenComponent
    RadzenChat
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.OnContextMenu(MouseEventArgs)
    RadzenComponent.GetCssClass()
    RadzenComponent.GetId()
    RadzenComponent.Debounce(Func<Task>, int)
    RadzenComponent.OnInitialized()
    RadzenComponent.SetParametersAsync(ParameterView)
    RadzenComponent.RaiseContextMenu(MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Dispose()
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.Reference
    RadzenComponent.CurrentStyle
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenChat : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    Examples
    <RadzenChat Title="Team Chat" 
                 CurrentUserId="@currentUserId"
                 Users="@users" 
                 Messages="@messages"
                 MessageSent="@OnMessageSent" />

    Constructors

    RadzenChat()

    RadzenChat component that provides a modern chat interface for multi-participant conversations.

    Declaration
    public RadzenChat()
    Examples
    <RadzenChat Title="Team Chat" 
                 CurrentUserId="@currentUserId"
                 Users="@users" 
                 Messages="@messages"
                 MessageSent="@OnMessageSent" />

    Properties

    ChatCleared

    Event callback that is invoked when the chat is cleared.

    Declaration
    [Parameter]
    public EventCallback ChatCleared { get; set; }
    Property Value
    Type Description
    EventCallback

    CurrentUserId

    Gets or sets the current user's participant ID.

    Declaration
    [Parameter]
    public string CurrentUserId { get; set; }
    Property Value
    Type Description
    string

    Disabled

    Gets or sets whether the chat is disabled.

    Declaration
    [Parameter]
    public bool Disabled { get; set; }
    Property Value
    Type Description
    bool

    EmptyMessage

    Gets or sets the message displayed when there are no messages.

    Declaration
    [Parameter]
    public string EmptyMessage { get; set; }
    Property Value
    Type Description
    string

    EmptyTemplate

    Gets or sets the empty template shown when there are no messages.

    Declaration
    [Parameter]
    public RenderFragment EmptyTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment

    The empty template.

    InputAttributes

    Specifies additional custom attributes that will be rendered by the input.

    Declaration
    [Parameter]
    public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
    Property Value
    Type Description
    IReadOnlyDictionary<string, object>

    The attributes.

    MaxMessages

    Gets or sets the maximum number of messages to keep in the chat.

    Declaration
    [Parameter]
    public int MaxMessages { get; set; }
    Property Value
    Type Description
    int

    MaxVisibleUsers

    Gets or sets the maximum number of users to show in the header.

    Declaration
    [Parameter]
    public int MaxVisibleUsers { get; set; }
    Property Value
    Type Description
    int

    MessageAdded

    Event callback that is invoked when a new message is added.

    Declaration
    [Parameter]
    public EventCallback<ChatMessage> MessageAdded { get; set; }
    Property Value
    Type Description
    EventCallback<ChatMessage>

    MessageSent

    Event callback that is invoked when a message is sent.

    Declaration
    [Parameter]
    public EventCallback<ChatMessage> MessageSent { get; set; }
    Property Value
    Type Description
    EventCallback<ChatMessage>

    MessageTemplate

    Gets or sets the message template.

    Declaration
    [Parameter]
    public RenderFragment<ChatMessage> MessageTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment<ChatMessage>

    The message template.

    Messages

    Gets or sets the list of chat messages.

    Declaration
    [Parameter]
    public IEnumerable<ChatMessage> Messages { get; set; }
    Property Value
    Type Description
    IEnumerable<ChatMessage>

    MessagesChanged

    Event callback that is invoked when the messages list changes.

    Declaration
    [Parameter]
    public EventCallback<IEnumerable<ChatMessage>> MessagesChanged { get; set; }
    Property Value
    Type Description
    EventCallback<IEnumerable<ChatMessage>>

    Placeholder

    Gets or sets the placeholder text for the input field.

    Declaration
    [Parameter]
    public string Placeholder { get; set; }
    Property Value
    Type Description
    string

    ReadOnly

    Gets or sets whether the input is read-only.

    Declaration
    [Parameter]
    public bool ReadOnly { get; set; }
    Property Value
    Type Description
    bool

    ShowClearButton

    Gets or sets whether to show the clear chat button.

    Declaration
    [Parameter]
    public bool ShowClearButton { get; set; }
    Property Value
    Type Description
    bool

    ShowUserNames

    Gets or sets whether to show participant names above messages.

    Declaration
    [Parameter]
    public bool ShowUserNames { get; set; }
    Property Value
    Type Description
    bool

    ShowUsers

    Gets or sets whether to show users in the header.

    Declaration
    [Parameter]
    public bool ShowUsers { get; set; }
    Property Value
    Type Description
    bool

    Title

    Gets or sets the title displayed in the chat header.

    Declaration
    [Parameter]
    public string Title { get; set; }
    Property Value
    Type Description
    string

    UserAdded

    Event callback that is invoked when a participant is added.

    Declaration
    [Parameter]
    public EventCallback<ChatUser> UserAdded { get; set; }
    Property Value
    Type Description
    EventCallback<ChatUser>

    UserRemoved

    Event callback that is invoked when a participant is removed.

    Declaration
    [Parameter]
    public EventCallback<ChatUser> UserRemoved { get; set; }
    Property Value
    Type Description
    EventCallback<ChatUser>

    Users

    Gets or sets the list of chat users.

    Declaration
    [Parameter]
    public IEnumerable<ChatUser> Users { get; set; }
    Property Value
    Type Description
    IEnumerable<ChatUser>

    UsersChanged

    Event callback that is invoked when the users list changes.

    Declaration
    [Parameter]
    public EventCallback<IEnumerable<ChatUser>> UsersChanged { get; set; }
    Property Value
    Type Description
    EventCallback<IEnumerable<ChatUser>>

    Methods

    AddMessage(string, string)

    Adds a message to the chat.

    Declaration
    public Task<ChatMessage> AddMessage(string content, string userId)
    Parameters
    Type Name Description
    string content

    The message content.

    string userId

    The ID of the participant who sent the message.

    Returns
    Type Description
    Task<ChatMessage>

    The created message.

    AddUser(ChatUser)

    Adds a participant to the chat.

    Declaration
    public Task AddUser(ChatUser participant)
    Parameters
    Type Name Description
    ChatUser participant

    The participant to add.

    Returns
    Type Description
    Task

    BuildRenderTree(RenderTreeBuilder)

    RadzenChat component that provides a modern chat interface for multi-participant conversations.

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    ClearChat()

    Clears all messages from the chat.

    Declaration
    public Task ClearChat()
    Returns
    Type Description
    Task

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    string
    Overrides
    RadzenComponent.GetComponentCssClass()

    GetMessages()

    Gets the current list of messages.

    Declaration
    public IReadOnlyList<ChatMessage> GetMessages()
    Returns
    Type Description
    IReadOnlyList<ChatMessage>

    GetUser(string)

    Gets a participant by their ID.

    Declaration
    public ChatUser GetUser(string userId)
    Parameters
    Type Name Description
    string userId

    The participant ID.

    Returns
    Type Description
    ChatUser

    The participant or null if not found.

    GetUsers()

    Gets the current list of users.

    Declaration
    public IReadOnlyList<ChatUser> GetUsers()
    Returns
    Type Description
    IReadOnlyList<ChatUser>

    LoadMessages(IEnumerable<ChatMessage>)

    Loads messages from an external source.

    Declaration
    public Task LoadMessages(IEnumerable<ChatMessage> messages)
    Parameters
    Type Name Description
    IEnumerable<ChatMessage> messages

    The messages to load.

    Returns
    Type Description
    Task

    OnAfterRenderAsync(bool)

    Called by the Blazor runtime.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender
    Returns
    Type Description
    Task
    Overrides
    RadzenComponent.OnAfterRenderAsync(bool)

    RemoveUser(string)

    Removes a participant from the chat.

    Declaration
    public Task RemoveUser(string userId)
    Parameters
    Type Name Description
    string userId

    The ID of the participant to remove.

    Returns
    Type Description
    Task

    SendMessage(string, string)

    Sends a message programmatically.

    Declaration
    public Task SendMessage(string content, string userId = null)
    Parameters
    Type Name Description
    string content

    The message content to send.

    string userId

    The ID of the participant sending the message (defaults to CurrentUserId).

    Returns
    Type Description
    Task

    UpdateUserStatus(string, bool)

    Updates a participant's online status.

    Declaration
    public Task UpdateUserStatus(string userId, bool isOnline)
    Parameters
    Type Name Description
    string userId

    The participant ID.

    bool isOnline

    The online status.

    Returns
    Type Description
    Task

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT