Badge

Description

A component to display a badge

Badges, Tags, and Chips are small visual elements used to categorize content, highlight status, or display metadata.

They come in various styles: Badges are typically static indicators, Tags are for categorization, and Chips often include interactive elements like a removal button.

API reference

enum

BadgeTone

public enum BadgeTone

Predefined visual tones used to color the Badge component.

Namespace
Tesserae
class

TokenBase<T>

public abstract class TokenBase<T> : ComponentBase<T, HTMLElement> where T : TokenBase<T>
Namespace
Tesserae
Inheritance
ComponentBase<T, HTMLElement> → TokenBase<T>

Properties

NameDescription
TextGets or sets the text shown in the component.
IconGets or sets the icon shown by the component.
IsPillReturns a value indicating whether the component is pill.
IsOutlineReturns a value indicating whether the component is outline.
IsFilledReturns a value indicating whether the component is filled.
Property
TokenBase.Text
public string Text { get ; set ; }

Gets or sets the text shown in the component.

Property
TokenBase.Icon
public string Icon { get ; set ; }

Gets or sets the icon shown by the component.

Property
TokenBase.IsPill
public bool IsPill { get ; set ; }

Returns a value indicating whether the component is pill.

Property
TokenBase.IsOutline
public bool IsOutline { get ; set ; }

Returns a value indicating whether the component is outline.

Property
TokenBase.IsFilled
public bool IsFilled { get ; set ; }

Returns a value indicating whether the component is filled.

Methods

NameDescription
SetTextSets the text of the component.
SetIconSets the icon of the component.
PillConfigures the component to pill.
OutlineConfigures the component to outline.
FilledConfigures the component to filled.
BackgroundGets or sets the CSS background of the component.
ForegroundGets or sets the CSS color (foreground) of the component.
ToneConfigures the component to tone.
PrimaryStyles the component using the primary tone.
SuccessStyles the component using the success tone.
WarningStyles the component using the warning tone.
DangerStyles the component using the danger tone.
InfoStyles the component using the informational tone.
NeutralConfigures the component to neutral.
OnRemoveRegisters a callback invoked when the remove event fires.
RemovableConfigures the component to removable.
RenderRenders the component's root HTML element.
Method
TokenBase.SetText
public T SetText(string text)

Sets the text of the component.

Method
TokenBase.SetIcon
public T SetIcon(string icon)

Sets the icon of the component.

Method
TokenBase.Pill
public T Pill(bool value = true)

Configures the component to pill.

Method
TokenBase.Outline
public T Outline(bool value = true)

Configures the component to outline.

Method
TokenBase.Filled
public T Filled(bool value = true)

Configures the component to filled.

Method
TokenBase.Background
public T Background(string color)

Gets or sets the CSS background of the component.

Method
TokenBase.Foreground
public T Foreground(string color)

Gets or sets the CSS color (foreground) of the component.

Method
TokenBase.Tone
public T Tone(BadgeTone tone)

Configures the component to tone.

Method
TokenBase.Primary
public T Primary()

Styles the component using the primary tone.

Method
TokenBase.Success
public T Success()

Styles the component using the success tone.

Method
TokenBase.Warning
public T Warning()

Styles the component using the warning tone.

Method
TokenBase.Danger
public T Danger()

Styles the component using the danger tone.

Method
TokenBase.Info
public T Info()

Styles the component using the informational tone.

Method
TokenBase.Neutral
public T Neutral()

Configures the component to neutral.

Method
TokenBase.OnRemove
public T OnRemove(Action<T> onRemove)

Registers a callback invoked when the remove event fires.

Method
TokenBase.Removable
public T Removable(bool value = true)

Configures the component to removable.

Method
TokenBase.Render
public override HTMLElement Render()

Renders the component's root HTML element.

class

Badge

public sealed class Badge : TokenBase<Badge>
Namespace
Tesserae
Inheritance
TokenBase<Badge> → Badge

Constructors

NameDescription
BadgeInitializes a new instance of this class.
Constructor
Badge
public Badge(string text = null) : base("tss-badge", text)

Initializes a new instance of this class.

class

Tag

public sealed class Tag : TokenBase<Tag>
Namespace
Tesserae
Inheritance
TokenBase<Tag> → Tag

Constructors

NameDescription
TagInitializes a new instance of this class.
Constructor
Tag
public Tag(string text = null) : base("tss-tag", text)

Initializes a new instance of this class.

class

Chip

public sealed class Chip : TokenBase<Chip>
Namespace
Tesserae
Inheritance
TokenBase<Chip> → Chip

Constructors

NameDescription
ChipInitializes a new instance of this class.
Constructor
Chip
public Chip(string text = null) : base("tss-chip", text)

Initializes a new instance of this class.

Samples

Standard Badges

Tags and Chips

Tags and chips support icons, pill shapes, and interactive removal.

See also

© 2026 Curiosity. All rights reserved.