Skip to content

Display

Badge

badge puts a count, a short text or a dot over the top right corner of the parts it holds, as MudBlazor's badge. The badge is a pill in its color:, primary by default, its text in the plain text color with the black outline, or with contrast: true in the dark or the light text color, whichever reads better on it. A count shows "9+" above 9 and nothing at 0; nil shows nothing too. The badge keeps the room of its upper half above and right of what it holds, so it never covers a neighbour, and the pointer and the keys pass through it to what it holds.

Buttons, tabs, commands and list rows also take badge: themselves, which draws the count at their end on a dark plate, as the mod browser's Filters button does; see Button.

Examples

A count

badge content: $game_party.items.size do
  button "Items", on_click: -> { SceneManager.call(Scene_Item) }
end

An Items button with the number of items the party carries over its corner

content: takes a lambda too, content: -> { $game_party.items.size }, read while the badge shows.

A dot

badge dot: true, color: :error do
  button "Skills", on_click: -> { SceneManager.call(Scene_Skill) }
end

A Skills button with a red dot over its corner

A short text

badge content: "New", color: :secondary do
  button "Library", on_click: -> { open_library }
end

A Library button with New over its corner

Params, events and keys

Every part also takes the params every part takes.

A count, a short text or a dot over the top right corner of the parts it holds, as MudBlazor's badge, such as the count of unread letters on a button.

Written badge ... with a do ... end block of markup.

Param Takes Default Live About
content: any value yes a count, "9+" above 9 and nothing at 0, or a short text such as "New"; nil shows nothing
dot: true, false false a dot instead of the content, such as for something new without a count
color: a color name such as :primary or :rainbow, "#RRGGBB", [r, g, b] or a game text color such as 2 the badge's color; the theme's primary color by default

Keys: none: the keys reach the parts it holds

Mouse: the pointer passes through the badge to the parts it holds

Something went wrong. Reload

Connection interrupted

The site keeps trying to reconnect.

Reconnecting…

Could not reconnect. Trying again in seconds.

Could not reconnect. Retry now or reload the page.

The page was paused.

Could not continue. Retry now or reload the page.