Class ChatBudget
How much of a spend budget a conversation has used, as a labelled bar.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class ChatBudget : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
A header line pairs the "Budget" label with the raw "spent / total unit" reading, and a LinearProgress underneath fills to the same ratio. Once spent reaches total the whole thing turns destructive, so an exhausted budget cannot be mistaken for a full one.
The bar is the package's own progress component rather than a bespoke fill, so it inherits the rounded-corner and density behaviour of every other progress in App UI.
Examples
A budget just over halfway through.
var budget = new ChatBudget { spent = 120, total = 200 };
parentElement.Add(budget);
In UXML, with a custom unit.
<appui:ChatBudget spent="200" total="200" unit="credits" />
Constructors
ChatBudget()
Default constructor.
Declaration
public ChatBudget()
Fields
barUssClassName
The styling class of the bar.
Declaration
public const string barUssClassName = "appui-chat-budget__bar"
Field Value
| Type | Description |
|---|---|
| string |
budgetLabel
The header label.
Declaration
public const string budgetLabel = "Budget"
Field Value
| Type | Description |
|---|---|
| string |
defaultUnit
The default unit suffix.
Declaration
public const string defaultUnit = "pts"
Field Value
| Type | Description |
|---|---|
| string |
exhaustedUssClassName
The styling class applied once the budget is used up.
Declaration
public const string exhaustedUssClassName = "appui-chat-budget--exhausted"
Field Value
| Type | Description |
|---|---|
| string |
headerIconUssClassName
The styling class of the header's leading glyph.
Declaration
public const string headerIconUssClassName = "appui-chat-budget__header-icon"
Field Value
| Type | Description |
|---|---|
| string |
headerUssClassName
The styling class of the header line.
Declaration
public const string headerUssClassName = "appui-chat-budget__header"
Field Value
| Type | Description |
|---|---|
| string |
labelUssClassName
The styling class of the "Budget" label.
Declaration
public const string labelUssClassName = "appui-chat-budget__label"
Field Value
| Type | Description |
|---|---|
| string |
readingUssClassName
The styling class of the "spent / total unit" reading.
Declaration
public const string readingUssClassName = "appui-chat-budget__reading"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The ChatBudget main styling class.
Declaration
public const string ussClassName = "appui-chat-budget"
Field Value
| Type | Description |
|---|---|
| string |
Properties
bar
The bar the budget fills.
Declaration
public LinearProgress bar { get; }
Property Value
| Type | Description |
|---|---|
| LinearProgress |
exhausted
Whether the budget is used up.
Declaration
public bool exhausted { get; }
Property Value
| Type | Description |
|---|---|
| bool |
progress
How full the budget is, from 0 to 1. A non-positive total reads as empty rather than dividing by zero.
Declaration
public float progress { get; }
Property Value
| Type | Description |
|---|---|
| float |
reading
The reading the header currently shows.
Declaration
public string reading { get; }
Property Value
| Type | Description |
|---|---|
| string |
spent
How much of the budget has been spent.
Declaration
[CreateProperty]
[UxmlAttribute]
public float spent { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
total
The size of the budget.
Declaration
[CreateProperty]
[UxmlAttribute]
public float total { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
unit
The unit suffix on the reading. "pts" by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public string unit { get; set; }
Property Value
| Type | Description |
|---|---|
| string |