Skip to content

Conversation

@wellingtoncosta
Copy link
Collaborator

@wellingtoncosta wellingtoncosta commented Dec 30, 2025

Summary

This PR introduces a new component called Badge, which is designed to be used in promotions, like New or Beta features. It isn't implemented in IJ platform, so this implementation is derived from similar small promotional UI components, like a small button.

The API allows passing a simple color as well as a brush. It can be clickable if you pass a valid lambda to the onClick parameter, or passing null to make the component non-clickable. Additionally, it has both enabled and disabled states as expected. Rounded corners are also possible by passing a custom value to the cornerSize in BadgeMetrics.

Evidences

Light
image
Dark
image

Release notes

⚠️ Important Changes

  • Introduced a brand new component called Badge, including a section to showcase the component in the sample app.

New features

  • Introduced the new Badge component, which is designed for promotions, like New or Beta.

Note

Introduces a new Badge UI component and wires it into theming and styling across modules.

  • Adds Badge composable with BadgeState, BadgeStyle/BadgeColors/BadgeMetrics, and LocalBadgeStyle; supports clickable/non-clickable, enabled/disabled, brushes, and rounded corners
  • Integrates into theme: DefaultComponentStyling now includes badgeStyle; JewelTheme.badgeStyle accessor; IntUi light/dark style factories; LaF bridge readBadgeStyle() and inclusion in IntUiBridge
  • Updates IntUiTheme.light/dark to accept/pass badgeStyle (adds new overloads; deprecates old ones) with fallbacks for compatibility
  • Adds showcase page (icons, Badges.kt) and UI tests for Badge behavior
  • API dumps updated accordingly

Written by Cursor Bugbot for commit 63d603e. This will update automatically on new commits. Configure here.

@wellingtoncosta wellingtoncosta self-assigned this Dec 30, 2025
@wellingtoncosta wellingtoncosta requested review from faogustavo and rock3r and removed request for rock3r December 30, 2025 21:30
@wellingtoncosta wellingtoncosta force-pushed the wp/badge-component branch 2 times, most recently from 745ae86 to 7b0685a Compare January 8, 2026 18:07

@Suppress("UnusedReceiverParameter")
public fun ComponentStyling.dark(
badgeStyle: BadgeStyle = BadgeStyle.dark(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Prioritize adding new params in the end to prevent breaking changes if the developer do not use named attributes

Comment on lines +26 to +37
public fun BadgeColors.Companion.light(
background: Brush = SolidColor(IntUiLightTheme.colors.blue(4)),
backgroundDisabled: Brush = SolidColor(IntUiLightTheme.colors.gray(12)),
backgroundFocused: Brush = SolidColor(IntUiLightTheme.colors.blue(5)),
backgroundPressed: Brush = SolidColor(IntUiLightTheme.colors.blue(6)),
backgroundHovered: Brush = SolidColor(IntUiLightTheme.colors.blue(5)),
content: Color = IntUiLightTheme.colors.gray(14),
contentDisabled: Color = IntUiLightTheme.colors.gray(8),
contentFocused: Color = IntUiLightTheme.colors.gray(14),
contentPressed: Color = IntUiLightTheme.colors.gray(14),
contentHovered: Color = IntUiLightTheme.colors.gray(14),
): BadgeColors =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QQ: Where have you found those values? They don't match StandAlone/IDE:

Image

colors = colors,
metrics =
BadgeMetrics(
cornerSize = CornerSize(0.dp),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Badges are only available as pills, as per specs; not sure why the corner size is zero where it should be 100%:

Image

Comment on lines +44 to +45
padding = PaddingValues(horizontal = 6.dp, vertical = 2.dp),
minSize = DpSize(32.dp, 18.dp),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

There should be no min width, and the height is fixed at 16.dp (not a minimum). Also no vertical padding — I assume we should centre the Text vertically instead.

Comment on lines +19 to +37
val normalBackground =
retrieveColorsOrUnspecified("Button.startBackground", "Button.endBackground").createVerticalBrush()

val normalContent = retrieveColorOrUnspecified("Label.foreground")
val disabledContent = retrieveColorOrUnspecified("Label.disabledForeground").takeOrElse { normalContent }

val colors =
BadgeColors(
background = normalBackground,
backgroundDisabled = normalBackground,
backgroundFocused = normalBackground,
backgroundPressed = normalBackground,
backgroundHovered = normalBackground,
content = normalContent,
contentDisabled = disabledContent,
contentFocused = normalContent,
contentPressed = normalContent,
contentHovered = normalContent,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem all wrong, according to the specs:

Image

Please do triple check the keys in the spec are correct since the Swing impl is notorious for not following specs — 1:1 fidelity to the actual implementation trumps specs

Comment on lines +16 to +24
public fun BadgeStyle.Companion.light(
colors: BadgeColors = BadgeColors.light(),
metrics: BadgeMetrics = BadgeMetrics.defaults(),
): BadgeStyle = BadgeStyle(colors = colors, metrics = metrics)

public fun BadgeStyle.Companion.dark(
colors: BadgeColors = BadgeColors.dark(),
metrics: BadgeMetrics = BadgeMetrics.defaults(),
): BadgeStyle = BadgeStyle(colors = colors, metrics = metrics)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the specs, we have 6 default badge styles (blue, bluePrimary, green, greenPrimary, purple, gray) — plus the disabled state, which is the same for all of them:

Image

So we should have a BridgeStyles that contains styling for all the 6 variants, and that has a light and a dark variant creation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants