Skip to content

Input suffix#327

Merged
svenvandescheur merged 4 commits intomainfrom
feature/326-input-suffix-extended
Mar 24, 2026
Merged

Input suffix#327
svenvandescheur merged 4 commits intomainfrom
feature/326-input-suffix-extended

Conversation

@robinmolen
Copy link
Copy Markdown
Collaborator

@robinmolen robinmolen commented Mar 16, 2026

Closes #326

This PR aims to support the usage of Button components as Input suffix.

  • Replacing the Input component prop icon with suffix, to suggest a more generic usage.
  • Added styling for 'Button component as Input suffix' usage.

If we want a more generic implementation, where any element can be used as suffix, then a setup like the bootstrap input group might be more useful. With such an setup we could allow any size of suffix, and 'automatically' adjust the width of the input.

Add a more generic suffix property to the Input component, which will replace the icon prop.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.00%. Comparing base (0056ff8) to head (0f3b73f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #327      +/-   ##
==========================================
+ Coverage   91.99%   92.00%   +0.01%     
==========================================
  Files         205      205              
  Lines        8447     8459      +12     
  Branches     1255     1254       -1     
==========================================
+ Hits         7771     7783      +12     
  Misses        673      673              
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add styling for Button components used as input suffix
Copy link
Copy Markdown
Collaborator

@svenvandescheur svenvandescheur left a comment

Choose a reason for hiding this comment

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

Code wise this looks OK, but I think maybe the button's styling can be improved to make it more clear that it's an interactive thing?

@robinmolen
Copy link
Copy Markdown
Collaborator Author

I'll update the test to showcase the more prominent button variants (primary, secondary, transparent and accent).

Regarding the central alignment, the input has an height that isn't dividable by 2. So the button spacing on the top is 1 pixel more than at the bottom. I'll check what can be done about this

In order to centrally align the input suffix, the height of the input needs to be dividable by 2. By adding a round function to the input line-height, we can ensure this.

Then, to properly showcase how the button suffix looks like, the storybook test has been updated to display the prominent variants (primary, secondary, accent and transparent).
When using a button as the suffix of an input component, we should support multiple size configurations.

The input component receives inline-end padding based on the button size. This ensures that the input content remains fully readable when using any button size.

For "nice" button/input spacing (ensuring that the spacing on the top, inline-end and bottom are the same), we use a specific inline-end for button suffix elements. For this styling we expect the input size and button size to be the same, providing support for each size combination will add a lot of complexity.

When using the xxs variants of the button and input, the spacing above and below is reduced to zero. To prevent the button from covering the input border, we set the inline-end to 1px.
@svenvandescheur svenvandescheur merged commit 115ebf8 into main Mar 24, 2026
9 checks passed
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.

Input extending allowed suffix elements

3 participants