Skip to content

Some properties provide flexibility for specific integrations. Follow the component's usage guidance. Customizations beyond the documented patterns need a use case approved by DNB UX. Read about intended use and customization.

Experimental: The AI extension and its component APIs may change in the future. Please give us feedback on your experience with them.

Properties#

TypeDescription
labelstring(optional) Label of the conversation for screen readers. Defaults to a translated text.
scrollBehavior"turn"
"end"
(optional) Use turn to scroll a new message from the user near the top, and let the reply stream in below it. Use end to follow the end of the conversation while the reply streams in.
idstring(optional) Identifier used to scroll the conversation from elsewhere with Ai.useConversation(id).
childrenReact.ReactNode(optional) The messages of the conversation.
itemsArray<AiConversationItem>(optional) Data-driven messages with stable unique IDs, optional from and keepMounted, and a render callback. Takes precedence over children. The wrapper owns the DOM ID.
renderDriverAiConversationDriver(optional) Opt-in rendering driver. Import createConversationVirtualization separately from @dnb/eufemia/extensions/ai/Virtualization. Requires items. The virtualized log leaves announcements to the application.
Spacestring
object
(optional) Spacing properties like top or bottom are supported.

Ai.useConversation#

Ai.useConversation(id) returns these functions. Without an id, it uses the conversation it is inside.

TypeDescription
scrollToEndfunction(optional) Scroll to the end and follow new content.
scrollToStartfunction(optional) Scroll to the start of the conversation.
scrollToMessagefunction(optional) Scroll to the message with the given id. Returns false when the message is not found.

Ai.useConversationVisibility#

Ai.useConversationVisibility(id) returns these values. Without an id, it uses the conversation it is inside. The messages are only tracked while the hook is used.

TypeDescription
currentTurnIdstring
null
(optional) The id of the message from the user that starts the turn the user is reading. Stays set when the message is scrolled above the view.
visibleMessageIdsArray<string>(optional) The ids of the messages that are visible, in the order they are shown.

Ai.useConversationScrollState#

Ai.useConversationScrollState(id) returns these values. Without an id, it uses the conversation it is inside.

TypeDescription
isAtStartboolean(optional) true when the conversation is scrolled to the start.
isAtEndboolean(optional) true when the conversation is scrolled to the end.
hasUnreadMessagesboolean(optional) true when new incoming messages arrived while reading older history. Clears at the end.

Translations#

Keynb-NOen-GBsv-SEda-DK
conversationLabelSamtaleConversationKonversationSamtale
scrollToBottomGå til siste meldingGo to latest messageGå till senaste meddelandetGå til seneste besked
newMessageNy meldingNew messageNytt meddelandeNy besked
Suggest an edit