Skip to main content

Status Pill

The status-pill component shows a message or a countdown with a svg icon or initial in a rounded container. The background color can be configured via attributes.

Use cases:

  • Highlighting state
  • Showing a countdown
  • Useful for distinguishing enumerated values

Example

Declaration

<rapid-status-pill></rapid-status-pill>

Usage

@customElement({
name: 'my-element',
template: html`
<rapid-status-pill
icon-name="check"
text="Success"
background-color="green"
>
</rapid-status-pill>
<rapid-status-pill
icon-name="xmark"
text="Failure"
background-color="red"
>
</rapid-status-pill>
<rapid-status-pill
icon-initial="S"
text="Live"
icon-initial-background-color="#0c52b9"
background-color="#547cb6"
>
</rapid-status-pill>
<rapid-status-pill
icon-initial="S"
icon="clock"
text="Market expires in"
background-color="#9c851b"
date-countdown=${x => x.fiveMinutesTimeInMiliseconds}
>
</rapid-status-pill>
`,
})
export class MyElement extends GenesisElement {
@observable fiveMinutesTimeInMiliseconds = Math.round(new Date().getTime() + 60000);
}

API

Attributes

This table shows attribute binding examples for Genesis Component syntax. The HTML closing tag is not included.

NameTypeDescriptionExample
background-colorstringThe fill color of the pill. Use a valid color, rgba, rgb or hex value.
<rapid-status-pill background-color="#547cb6">
icon-namestringThe name of the icon (matching with the name in fontawesome).
<rapid-status-pill icon-name="check">
icon-srcstringA URL for an image asset to be used.
<rapid-status-pill icon-src="/logos/custom-image.svg"">
icon-initialstringDisplay a single letter at the start of the pill. Note, will only display the first character of the string.
<rapid-status-pill icon-initial="S">
icon-initial-background-colorlstringThe fill color of the icon-initial, if the icon-initial is set. Use a valid color, rgba, rgb or hex value.
<rapid-status-pill icon-initial-background-color="red">
icon-size"2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "1x" | "2x" | "3x" | "4x" | "5x" | "6x" | "7x" | "8x" | "9x" | "10x"Controls the size of the icon in the pill. Default: "sm"
<rapid-status-pill icon-size="xl">
text-colorstringThe text color in the pill. Use a valid color, rgba, rgb or hex value. Note, this will be applied to the icon as well.
<rapid-status-pill text-color="red">
textstringThe text in the pill
<rapid-status-pill text="Settled">
date-countdownnumberAn epoch timestamp value which will create a countdown in hours, minutes and seconds. If the timestamp is in the past an expired message will show.
<rapid-status-pill date-countdown="1751550867041">
date-countdown-completed-messagestringA message that is shown when the countdown, if present and completed, is shown. Default 'Expired'
<rapid-status-pill date-countdown-completed-message="Market Closed">

Properties

This component doesn't have any properties.

Slots

This component doesn't have any slots.

Parts

NameDescription
status-pillThe element containing icons, images and text. If you using a large enough icon, you will need to increase the height. Ensure the border radius is exactly half the specified height to achieve rounded corners.

Events fired

This component doesn't fire any events.

Events listened to

This component doesn't listen to any events.