Skip to contentSkip to content

ChatMessageAuthorLabel API

API reference docs for the React ChatMessageAuthorLabel component. Learn about the props, CSS, and other APIs of this exported module.

Demos

Import

import { ChatMessageAuthorLabel } from '@mui/x-chat/ChatMessage';
// or
import { ChatMessageAuthorLabel } from '@mui/x-chat';

Learn about the difference by reading this guide on minimizing bundle size.

Props

NameTypeDefaultDescription
classesobject-

Override or extend the styles applied to the component.

See CSS classes API below for more details.

slotPropsobject{}

The props used for each component slot.

slotsobject{}

Overridable component slots.

See Slots API below for more details.

The component cannot hold a ref.

Slots

Slot nameClass nameDefault componentDescription
authorLabel.MuiChatMessageAuthorLabel-authorLabelThe component that renders the author label.

CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

Class nameRule nameDescription
.Mui-errorApplied when the message has an error status
.MuiChatMessageAuthorLabel-actionsactionsStyles applied to the message actions element.
.MuiChatMessageAuthorLabel-avataravatarStyles applied to the message avatar element.
.MuiChatMessageAuthorLabel-bubblebubbleStyles applied to the message bubble element inside content.
.MuiChatMessageAuthorLabel-contentcontentStyles applied to the message content element.
.MuiChatMessageAuthorLabel-dateDividerdateDividerStyles applied to the date divider element.
.MuiChatMessageAuthorLabel-dateDividerLabeldateDividerLabelStyles applied to the formatted day label inside the date divider.
.MuiChatMessageAuthorLabel-dateDividerLinedateDividerLineStyles applied to the horizontal rule on each side of the date divider label.
.MuiChatMessageAuthorLabel-groupgroupStyles applied to the message group element.
.MuiChatMessageAuthorLabel-groupAuthorNamegroupAuthorNameClass applied to the group author name element.
.MuiChatMessageAuthorLabel-groupTimestampgroupTimestampClass applied to the group timestamp element (compact variant only).
.MuiChatMessageAuthorLabel-inlineMetainlineMetaStyles applied to the inline meta container element (default variant).
.MuiChatMessageAuthorLabel-inlineMetaSpacerinlineMetaSpacerStyles applied to the inline meta spacer element (default variant).
.MuiChatMessageAuthorLabel-metametaStyles applied to the message meta element.
.MuiChatMessageAuthorLabel-noAvatarnoAvatarApplied when the avatar slot is hidden (slots.avatar: null) so the grid drops the avatar track.
.MuiChatMessageAuthorLabel-roleAssistantroleAssistantApplied when the message role is 'assistant'
.MuiChatMessageAuthorLabel-roleUserroleUserApplied when the message role is 'user'
.MuiChatMessageAuthorLabel-rootrootStyles applied to the message root element.
.MuiChatMessageAuthorLabel-streamingstreamingApplied while the message is streaming

You can override the style of the component using one of these customization options:

Source code

If you did not find the information in this page, consider having a look at the implementation of the component for more detail.