Skip to content
Elements Chip

Chip

A small dot or count placed on a corner of another element.

On this page

Examples

Positions and states

5 12
Razor
<div class="flex flex-wrap items-center gap-8">
    <KlyChip Label="New messages">
        <KlyAvatar Alt="Ada Lovelace" Size="KlySize.Lg" />
    </KlyChip>
    <KlyChip Text="5" Label="5 notifications" Color="KlyColor.Error">
        <KlyButton Label="Inbox" Variant="ButtonVariant.Outline" Color="KlyColor.Neutral" />
    </KlyChip>
    <KlyChip Position="KlyChipPosition.BottomRight" Color="KlyColor.Success" Size="KlySize.Lg" Label="Online">
        <KlyAvatar Alt="Grace Hopper" Size="KlySize.Xl" />
    </KlyChip>
    <KlyChip Position="KlyChipPosition.TopLeft" Inset Show="false">
        <KlyAvatar Alt="Hidden chip" Size="KlySize.Lg" />
    </KlyChip>
    <KlyChip Standalone Text="12" Label="12 unread" Color="KlyColor.Info" Size="KlySize.Lg" />
</div>

API

KlyChip

Small badge placed on a corner of its content, as a dot, a count or a status.

Parameters

Name Type Default Description
Class string Classes added to the root element, merged last so they win over the theme.
Color KlyColor "primary" Semantic color of the chip: a built-in KlyColor or the name of a color you defined. Values: primary, secondary, success, info, warning, error, neutral.
Inset bool false Keeps the indicator inside the corner of the element instead of straddling it.
Label string Accessible text of the indicator ("3 unread messages"). Without it a dot is hidden from assistive technology and a text is read as it is: never rely on the color alone to convey a meaning.
Position KlyChipPosition KlyChipPosition.TopRight Corner of the content where the chip sits ( KlyChipPosition ). Defaults to the top right. Values: TopRight, TopLeft, BottomRight, BottomLeft.
Show bool true Shows the indicator. Set it to false to hide it without removing the element it sits on.
Size KlySize KlySize.Md Size of the chip, from Xs to Xl . When not set, Size applies, else the default of the component. Values: Xs, Sm, Md, Lg, Xl.
Standalone bool false Renders the indicator on its own, in the flow, without an element to sit on.
Text string Text inside the indicator, a count for example. Without it the indicator is a dot.
Ui ChipUi Per-instance class overrides of the slots of the chip, see ChipUi . They are merged after the theme and the Class parameter wins on the root slot.

Slots

Name Type Description
ChildContent RenderFragment The element the indicator sits on, an avatar or a button for example.

Ui slots

Ui takes a ChipUi with one class string per slot, merged after the theme.

Slot Styles
Root Classes merged into the root slot of KlyChip , after the theme and the app configuration.
Base Classes merged into the base slot of KlyChip , after the theme and the app configuration.