Class ChatAssetRow
Everything a chat surface shows about one asset.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class ChatAssetRow : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
A thumbnail on the left, an identity block on the right: title, source, an optional pack, an optional details link, an optional creator, an optional two-line description, optional tags, an optional price, an optional size and an optional status line, then an optional consumer extra element. Every optional line hides itself when it has nothing to say, so the row never leaves a gap.
The row deliberately has no list semantics, no click behaviour of its own and no trailing control. A caller renders it inside its own list item and owns the interaction around it.
statusTone is how the caller says a status counts as a problem, but the row owns which token expresses that, so the mapping lives in one place and a consumer cannot inject arbitrary styling. state is separate on purpose: it is the row's lifecycle, and tone is how the caller wants that read.
Examples
A row that failed.
var row = new ChatAssetRow
{
title = "Sci-Fi Crate",
sourceLabel = "Asset Store",
packLabel = "Sci-Fi Props Vol. 2",
priceLabel = "$12",
state = AssetRowState.Failed,
statusText = "Download failed",
statusTone = AssetRowStatusTone.Destructive
};
parentElement.Add(row);
In UXML.
<appui:ChatAssetRow title="Sci-Fi Crate" source-label="Asset Store" state="Added" />
Constructors
ChatAssetRow()
Default constructor.
Declaration
public ChatAssetRow()
Fields
creatorLinkUssClassName
The styling class applied to the creator label while it is offered as a link.
Declaration
public const string creatorLinkUssClassName = "appui-chat-asset-row__creator--link"
Field Value
| Type | Description |
|---|---|
| string |
creatorUssClassName
The styling class of the creator line.
Declaration
public const string creatorUssClassName = "appui-chat-asset-row__creator"
Field Value
| Type | Description |
|---|---|
| string |
descriptionUssClassName
The styling class of the description, clamped to two lines.
Declaration
public const string descriptionUssClassName = "appui-chat-asset-row__description"
Field Value
| Type | Description |
|---|---|
| string |
detailsButtonUssClassName
The styling class of the details link.
Declaration
public const string detailsButtonUssClassName = "appui-chat-asset-row__details-button"
Field Value
| Type | Description |
|---|---|
| string |
extraUssClassName
The styling class applied to the consumer's extra element.
Declaration
public const string extraUssClassName = "appui-chat-asset-row__extra"
Field Value
| Type | Description |
|---|---|
| string |
identityUssClassName
The styling class of the identity block.
Declaration
public const string identityUssClassName = "appui-chat-asset-row__identity"
Field Value
| Type | Description |
|---|---|
| string |
mediaUssClassName
The styling class of a caller-supplied medium standing in for the thumbnail.
Declaration
public const string mediaUssClassName = "appui-chat-asset-row__media"
Field Value
| Type | Description |
|---|---|
| string |
packLabelUssClassName
The styling class of the pack label.
Declaration
public const string packLabelUssClassName = "appui-chat-asset-row__pack-label"
Field Value
| Type | Description |
|---|---|
| string |
priceUssClassName
The styling class of the price line.
Declaration
public const string priceUssClassName = "appui-chat-asset-row__price"
Field Value
| Type | Description |
|---|---|
| string |
separator
The separator drawn between the source and the pack.
Declaration
public const string separator = "·"
Field Value
| Type | Description |
|---|---|
| string |
separatorUssClassName
The styling class of the separator between the source and the pack.
Declaration
public const string separatorUssClassName = "appui-chat-asset-row__separator"
Field Value
| Type | Description |
|---|---|
| string |
sizeUssClassName
The styling class of the size line.
Declaration
public const string sizeUssClassName = "appui-chat-asset-row__size"
Field Value
| Type | Description |
|---|---|
| string |
sourceLabelUssClassName
The styling class of the source label.
Declaration
public const string sourceLabelUssClassName = "appui-chat-asset-row__source-label"
Field Value
| Type | Description |
|---|---|
| string |
sourceUssClassName
The styling class of the source line.
Declaration
public const string sourceUssClassName = "appui-chat-asset-row__source"
Field Value
| Type | Description |
|---|---|
| string |
stateUssClassName
The ChatAssetRow lifecycle styling class.
Declaration
public const string stateUssClassName = "appui-chat-asset-row--state-"
Field Value
| Type | Description |
|---|---|
| string |
statusToneUssClassName
The ChatAssetRow status tone styling class.
Declaration
public const string statusToneUssClassName = "appui-chat-asset-row__status--"
Field Value
| Type | Description |
|---|---|
| string |
statusUssClassName
The styling class of the status line.
Declaration
public const string statusUssClassName = "appui-chat-asset-row__status"
Field Value
| Type | Description |
|---|---|
| string |
tagUssClassName
The styling class of one tag pill.
Declaration
public const string tagUssClassName = "appui-chat-asset-row__tag"
Field Value
| Type | Description |
|---|---|
| string |
tagsUssClassName
The styling class of the strip holding the tags.
Declaration
public const string tagsUssClassName = "appui-chat-asset-row__tags"
Field Value
| Type | Description |
|---|---|
| string |
thumbnailPlaceholderUssClassName
The styling class of the thumbnail's placeholder glyph.
Declaration
public const string thumbnailPlaceholderUssClassName = "appui-chat-asset-row__thumbnail-placeholder"
Field Value
| Type | Description |
|---|---|
| string |
thumbnailUssClassName
The styling class of the thumbnail.
Declaration
public const string thumbnailUssClassName = "appui-chat-asset-row__thumbnail"
Field Value
| Type | Description |
|---|---|
| string |
titleUssClassName
The styling class of the title.
Declaration
public const string titleUssClassName = "appui-chat-asset-row__title"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The ChatAssetRow main styling class.
Declaration
public const string ussClassName = "appui-chat-asset-row"
Field Value
| Type | Description |
|---|---|
| string |
Properties
creatorLabel
Who made the asset. Null or empty hides the line.
Declaration
[CreateProperty]
[UxmlAttribute]
public string creatorLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
creatorLink
Whether the creator label is offered as a link. False by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool creatorLink { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Off, the label is plain text, so a source that knows a name but no page still shows the name. On, activating it raises creatorRequested.
description
A short text describing the item, such as what it was made from. Clamped to two lines, so a long one never pushes the rows below out of view. Null or empty hides the line.
Declaration
[CreateProperty]
[UxmlAttribute]
public string description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
USS has neither line-clamp nor line-height, so the row measures two lines of
the description's own text style and caps the element at that height. The cap follows the
font size the tokens resolve to, so it holds at every density.
details
Whether the details link is offered. False by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool details { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
detailsButton
The details link.
Declaration
public IconButton detailsButton { get; }
Property Value
| Type | Description |
|---|---|
| IconButton |
extra
An element rendered under the row's facts, after the status line: a control the consumer adds for this item, such as an editor for its description. The row stays a plain row; the consumer owns what the control does. Setting it back to null removes it.
Declaration
[CreateProperty]
public VisualElement extra { get; set; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
fallbackIcon
The name of the symbol shown when there is no thumbnail to draw. Defaults to a generic asset cube.
Declaration
[CreateProperty]
[UxmlAttribute]
public string fallbackIcon { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A consumer that knows what kind of thing the row describes passes its own symbol, so an item with no picture still reads as what it is. Named, not styled, by the consumer: the size and colour stay here so every row's placeholder matches.
media
An element rendered in place of the thumbnail.
Declaration
[CreateProperty]
public VisualElement media { get; set; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Remarks
Lets a consumer supply a richer medium for rows whose content is not an image -- an AudioPreview for a sound, say -- without this row knowing what that medium is. Setting it back to null restores the thumbnail.
packLabel
The pack the asset belongs to. Null or empty hides it, and the separator with it.
Declaration
[CreateProperty]
[UxmlAttribute]
public string packLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
priceLabel
A pre-formatted commercial price, for instance "$12" or "Free". The row does no currency formatting of its own. Null or empty hides the line.
Declaration
[CreateProperty]
[UxmlAttribute]
public string priceLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
sizeLabel
A pre-formatted size or cost of the item, for instance "≈ 48 MB". The row does no formatting of its own. Null or empty hides the line.
Declaration
[CreateProperty]
[UxmlAttribute]
public string sizeLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
sourceLabel
Where the asset came from, for instance a catalog name. Always shown.
Declaration
[CreateProperty]
[UxmlAttribute]
public string sourceLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
state
Where the row is in its lifecycle. Pending by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public AssetRowState state { get; set; }
Property Value
| Type | Description |
|---|---|
| AssetRowState |
statusText
Why the row is in the state it is in. Null or empty hides the line.
Declaration
[CreateProperty]
[UxmlAttribute]
public string statusText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
statusTone
How the status line reads. Muted by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public AssetRowStatusTone statusTone { get; set; }
Property Value
| Type | Description |
|---|---|
| AssetRowStatusTone |
tags
Short facts shown as tags under the description, for instance a format or a length. Null or empty hides the strip.
Declaration
[CreateProperty]
[UxmlAttribute]
public List<string> tags { get; set; }
Property Value
| Type | Description |
|---|---|
| List<string> |
Remarks
The registry draws each tag as a secondary Badge. UI Toolkit's Badge is a
notification overlay rather than a pill, so the row draws its own pills, styled from the
tokens the registry's secondary badge reads. The setter copies the incoming list, so a caller
mutating its own list afterwards does not silently desynchronise what is on screen.
thumbnail
The asset's thumbnail. Unset, the row shows a cube placeholder instead of a broken image.
Declaration
[CreateProperty]
public Background thumbnail { get; set; }
Property Value
| Type | Description |
|---|---|
| Background |
title
The asset's name.
Declaration
[CreateProperty]
[UxmlAttribute]
public string title { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetStateUssClassName(AssetRowState)
Declaration
public static string GetStateUssClassName(AssetRowState enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetRowState | enumValue |
Returns
| Type | Description |
|---|---|
| string |
GetStatusToneUssClassName(AssetRowStatusTone)
Declaration
public static string GetStatusToneUssClassName(AssetRowStatusTone enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetRowStatusTone | enumValue |
Returns
| Type | Description |
|---|---|
| string |
Events
creatorRequested
Raised when the creator label is activated, while creatorLink is on.
Declaration
public event Action creatorRequested
Event Type
| Type | Description |
|---|---|
| Action |
Remarks
The registry names the creator's page with a creatorUrl and has to check that it
is an absolute http(s) URL before turning it into an href, because a bare catalog
path would resolve against the host app's own origin and lead nowhere. There is no
href here, so there is nothing to guard: the row reports the intent and the host
decides where, and whether, to go. Same shape as
detailsRequested.
detailsRequested
Raised when the details link is activated.
Declaration
public event Action detailsRequested
Event Type
| Type | Description |
|---|---|
| Action |