• 
      

    Add a new badge component.

    Review Request #15108 — Created June 9, 2026 and updated

    Information

    Ink
    master

    Reviewers

    We're starting to accumulate badge-like things in a few different
    places. This change makes a new badge inside Ink that should be flexible
    enough to handle our existing use cases.

    This includes a "type" field that respects our existing status states
    (standard, info, success, warning, and error) and includes a mode with
    an icon. Custom colors can be done by overriding the CSS variables.

    • Ran unit tests.
    • Verified the appearance within the new storybook entry.
    Summary ID
    Add a new badge component.
    We're starting to accumulate badge-like things in a few different places. This change makes a new badge inside Ink that should be flexible enough to handle our existing use cases. This includes a "type" field that respects our existing status states (standard, info, success, warning, and error) and includes a mode with an icon. Custom colors can be done by overriding the CSS variables. Testing Done: - Ran unit tests. - Verified the appearance within the new storybook entry.
    nzlkpnnrkuuuzwyuokutoptzmyzpwwpu

    Description From Last Updated

    Doesn't have to be this change, but we'll also want a ink-c-badges component that can be an inline-flex of badges …

    chipx86 chipx86

    Maybe it's just the roundness of the icon, but I wonder if spacing could be tightened up a bit. If …

    chipx86 chipx86

    This (here and elsewhere) should be hitting the lint warning about alphabetical order of keys. Can you ensure these are …

    chipx86 chipx86
    chipx86
    1. 
        
    2. Show all issues

      Maybe it's just the roundness of the icon, but I wonder if spacing could be tightened up a bit. If an icon is present, maybe left padding can be set to the same as bottom padding?

      1. Looking at it zoomed in like this, it also seems there's inconsistency in the vertical spacing within it. I can see this with just text on the others too.

      2. I'm not sure what you mean with vertical inconsistency. There's equal padding top and bottom. Anything else is subject to browser font rendering.

      3. I'm away from the computer so I'll point this out in more detail later, but this can happen with vertically aligning an icon and text when the icon is the anchor point for alignment. I've had to work around this elsewhere.

      4. OK, yes, that needs some adjustment. I'm not sure what you're talking about with "just text on the others" though.

      5. In the screenshots, the text is all heavily weighted toward the bottom of each badge (with or without icons). 9-10px above the highest point, 6-7px below the lowest, depending on the badge. It looks pretty noticeable, and I was trying to account for why it'd be so shifted.

        I tried locally and I can't reproduce this issue, so I don't know what's going on in the screenshots. The rendering in yours and in mine (regardless of browser) is quite different. But it seems fine. So it must come down to font differences, but I wanted to be sure.

        Here's how that looks (your Success on the left, mine on the right).

        Image

    3. 
        
    david
    david
    chipx86
    1. 
        
    2. Show all issues

      Doesn't have to be this change, but we'll also want a ink-c-badges component that can be an inline-flex of badges with standardized spacing and flex wrapping (mirroring what we have in Review Board for a list of badges).

      1. I'll track that for later.

    3. src/stories/components/badge.stories.ts (Diff revisions 1 - 2)
       
       
       
       
      Show all issues

      This (here and elsewhere) should be hitting the lint warning about alphabetical order of keys. Can you ensure these are all in sorted order?

      1. Apparently the standard storybook config for eslint explicitly turns off the sort-keys rule:

          const storybookConfig = config.defineConfig([{
            rules: {
              // Don't warn about sorting keys in objects.
              // There's a reasonable Story-specific flow to Story configurations,
              // and sorting by key isn't necessarily it. Allow Stories to define
              // the flows they want.
              'sort-keys': 'off'
            }
          }]);
        

        I'll fix up things where they make sense.

    4. 
        
    david
    Review request changed
    Commits:
    Summary ID
    Add a new badge component.
    We're starting to accumulate badge-like things in a few different places. This change makes a new badge inside Ink that should be flexible enough to handle our existing use cases. This includes a "type" field that respects our existing status states (standard, info, success, warning, and error) and includes a mode with an icon. Custom colors can be done by overriding the CSS variables. Testing Done: - Ran unit tests. - Verified the appearance within the new storybook entry.
    nzlkpnnrkuuuzwyuokutoptzmyzpwwpu
    Add a new badge component.
    We're starting to accumulate badge-like things in a few different places. This change makes a new badge inside Ink that should be flexible enough to handle our existing use cases. This includes a "type" field that respects our existing status states (standard, info, success, warning, and error) and includes a mode with an icon. Custom colors can be done by overriding the CSS variables. Testing Done: - Ran unit tests. - Verified the appearance within the new storybook entry.
    nzlkpnnrkuuuzwyuokutoptzmyzpwwpu

    Checks run (2 succeeded)

    flake8 passed.
    JSHint passed.