docs v1.0.0

Avatar

Returns BoxNamespace Bibui.Core.RuntimeSourceTheme tokens

A circle with bold initials centred on it. It takes nothing: it only shows who.

Preview
Verified render
avatar-default
avatar-default

Fixtures: avatar-default and avatar-large.

Build

C#
public static Box Build(
    BibuiRuntime runtime,
    ReadOnlySpan<char> initials,
    float size = DefaultSize,
    UiColor? fill = null,
    UiColor? ink = null,
    ComponentSize fontSize = ComponentSize.Lg)

public const float DefaultSize = 40f;
ParameterMeaning
initialsWhat it reads. One to three characters fit.
sizeThe circle's diameter in pixels.
fill, inkThe circle's and the initials' colours, if not the defaults.
fontSizeThe initials' size.

Claims and reports

None. It returns a keyless Box.

State the caller owns

None.

Theme tokens

  • Circle: fill, or Accent.
  • Initials: ink, or AccentForeground, bold.

Example

C#
using Bibui.Core;
using Bibui.Core.Runtime;

sealed class Reviewer
{
    const string Initials = "MK";

    public UiNode Build(BibuiRuntime runtime)
        => Avatar.Build(runtime, Initials, size: 32f, fill: UiColor.SurfaceRaised, ink: UiColor.TextPrimary,
            fontSize: ComponentSize.Sm);
}