Skip to content

Conversation

@mstahv
Copy link
Member

@mstahv mstahv commented Nov 5, 2025

Fixes #5379

Type of change

  • Bugfix
  • Feature

Let's create a new Java API for Badge component.

This component is special from it's client-side implementation in a way that there is no web component for it. Technically it is just a set of style rules.

But for Java developers it is a component like others. A clean Java API will help users to use it from IDE. The official documentation currently makes developers use the lower level Element API (via getElement()), use "faceless" Span component (which many Java developers don't know of) and use "magic strings" in theme list (which is also a strange concept we want to hide).

Although the component is essentially just CSS rules, the implementation should have a set of tests, from which we can ensure it looks appropriate at least manually. Also elsewhere (in project structure and Java code style), try to re-use the same principles as with other components, even if the client-side implementation is bit different to most other Vaadin components.

Investigate also these as references:

Issue that discribes the missing feature:

vaadin/web-components#5379

Current documentation how to use it:

https://vaadin.com/docs/v25/components/badge

A community developed version of this component (uses CSS copied into that project, this should use core Lumo theme rules directly):
https://github.com/viritin/flow-viritin/blob/v24/src/main/java/org/vaadin/firitin/components/badge/Badge.java
Now compiles and it project shows something meaningful
@vaadin-bot
Copy link
Collaborator

TC Format Checker Report - 09:44 - 05 - Nov

BLOCKER There are 5 files with format errors

  • To see a complete report of formatting issues, download the differences file

  • To fix the build, please run mvn spotless:apply in your branch and commit the changes.

  • Optionally you might add the following line in your .git/hooks/pre-commit file:

    mvn spotless:apply
    

Here is the list of files with format issues in your PR:

vaadin-badge-flow-parent/vaadin-badge-flow-integration-tests/src/main/java/com/vaadin/flow/component/badge/tests/BadgePage.java
vaadin-badge-flow-parent/vaadin-badge-flow-integration-tests/src/test/java/com/vaadin/flow/component/badge/tests/BadgeIT.java
vaadin-badge-flow-parent/vaadin-badge-flow/src/main/java/com/vaadin/flow/component/badge/Badge.java
vaadin-badge-flow-parent/vaadin-badge-flow/src/test/java/com/vaadin/flow/component/badge/BadgeTest.java
vaadin-badge-flow-parent/vaadin-badge-testbench/src/main/java/com/vaadin/flow/component/badge/testbench/BadgeElement.java

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 5, 2025

Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

Blocking this PR for now, it needs to wait at least until 25.1 as we have now reached a feature freeze for 25.0.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants