Badge
A small label for a status or a count, such as "New" on a shop item.

Lucy.Stack.new({
direction = "horizontal",
gap = "Space2",
children = {
Lucy.Badge.new({ text = "New" }),
Lucy.Badge.new({ text = "Owned", variant = "secondary" }),
Lucy.Badge.new({ text = "Sold out", variant = "destructive" }),
Lucy.Badge.new({ text = "128 BPM", variant = "outline" }),
},
Parent = parent,
})
Props
| Prop | Type | Default | State key | What it does |
|---|---|---|---|---|
text | string | "Badge", or "" with an icon or children | yes | The label |
icon | string | yes | An icon name drawn before the text, in the badge's colour (badge.icon) | |
children | table | Anything after the text in the badge's slot: strings, components, instances or builders. They take the badge's colours | ||
variant | string | "default" | yes | default, secondary, destructive, outline or overlay (a translucent fill for a count over a picture: dark with white words in the dark theme, light with dark words in the light one) |
shape | string | "rounded" | yes | rounded, or square: only slightly rounded ($RadiusXs, 3 px) and a little tighter, for tags and labels such as a rarity |
size | string | "sm" | yes | sm, md, lg or xl. Its words are a Button's at the same size, and its icon and padding grow with them |
visible | boolean | true | yes | Shows or hides the badge |
It also takes the props every component takes.
Examples
A badge for each variant:

for _, variant in { "default", "secondary", "destructive", "outline" } do
Lucy.Badge.new({ text = variant, variant = variant, Parent = row })
end
A count of track requests that follows a value:

local requests = Lucy.ref(3)
Lucy.Badge.new({
text = function() return tostring(requests()) end,
variant = "destructive",
visible = function() return requests() > 0 end,
Parent = queueTab,
})
How many of a dance a player owns, on the corner of its tile. overlay is a
translucent fill, so the number reads on any picture:

local tile = Lucy.Avatar.new({ name = "Moonwalk", size = "xl", square = true, Parent = parent })
local owned = Lucy.Badge.new({ text = "3", variant = "overlay", Parent = tile.Instance })
owned.Instance.AnchorPoint = Vector2.new(1, 1)
owned.Instance.Position = UDim2.new(1, -4, 1, -4)
A badge is a box with a slot: an icon, words, or anything else sits inside it in a row, in the badge's colours.
-- An icon alone
Lucy.Badge.new({ icon = "lucide-extended:music-filled", variant = "secondary", Parent = row })
-- An icon and a count
Lucy.Badge.new({ icon = "lucide-extended:users-filled", text = "12", Parent = row })
-- Anything: a level and a star after it
Lucy.Badge.new({
text = "LV 12",
children = { Lucy.Icon.new({ icon = "lucide-extended:star-filled" }) },
Parent = row,
})
A badge at each size. Its words match a Button of the same size, so a
lg badge reads right beside a lg button. Use a bigger one for a tag
players need to read at a glance, such as a dancer's genre and level:

for _, size in { "sm", "md", "lg", "xl" } do
Lucy.Badge.new({ text = string.upper(size), variant = "outline", size = size, Parent = row })
end
Lucy.Badge.new({ icon = "lucide-extended:star-filled", text = "LV 12", size = "lg", Parent = row })
To colour a badge your own way, use
Slot.foreground, so its words and icon
change together.
Preview
In Studio, from the command bar: Lucy.Preview.show("Badge").