Skip to main content

Level Indicator

shadow

The Level Indicator component is an element that allows you to view the level or progress of a process. It can be used to display battery level, user progress or other similar tasks.

Basic use

This example shows the level indicator in its simplest form so the default level distribution is easy to read.

Colorize

By adding the colorize attribute, the indicator bars are colored according to the level (low, medium, high).

Sulphur indicator bars

By setting the CSS variable --wje-level-indicator-width to any value, the width of the indicator bars can be set.

Reverse

Adding the reverse attribute will display the indicator bars in reverse order.

When to use

Use wje-level-indicator to communicate status, result of actions, or required next steps immediately.

When not to use

Do not show multiple feedback channels for the same event unless there is a strong reason.

Accessibility

Announce status updates with suitable ARIA live regions and manage focus for modal interactions.

Best Practices

  • Match message severity (info/success/warning/error) to actual user impact.
  • Use confirmations only for destructive or hard-to-reverse actions.
  • Keep timeouts consistent so users have enough time to read messages.

Attributes and Properties

bars

DescriptionRetrieves the value of the "bars" attribute, parses it as an integer, and ensures it is at least 1. If the attribute is not set, defaults to 3.
Attributebars
Typestring
Default-

colorize

DescriptionSets the 'colorize' attribute on the element. If the provided value is truthy, the attribute will be set. If the value is falsy, the attribute will be removed.
Attributecolorize
Typeboolean
Defaultfalse

level

DescriptionRetrieves the level attribute of an element, with validation to ensure it is within the range of 0 to 3. If the level attribute is not present, the default value is 1. The result is parsed as an integer and constrained to the valid range.
Attributelevel
Typestring
Default-

reverse

DescriptionSets the 'reverse' attribute on the element. If the provided value is truthy, the attribute is added; otherwise, the attribute is removed.
Attributereverse
Typeboolean
Defaultfalse

Events

No events available for this component.

Methods

updateBars

DescriptionUpdates the class of each bar element based on the specified level.
Signature(level: number, bars: Array) => void

getColor

DescriptionDetermines the color indicator based on the given level and bars.
Signature(level: number, bars: number) => string | undefined

CSS Shadow Parts

NameDescription
``Styles the element.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

No slots available for this component.