Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Select button main content grow #1767

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Make Select button main content grow #1767

merged 1 commit into from
Nov 5, 2024

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Nov 5, 2024

This PR makes the content provided as buttonContent to a Select or MultiSelect component take all available space, except for the chevron.

This allows to pass a flex container to buttonContent and allow to place items at the end, right before the chevron icon.

Before:

toggle-button-left-2024-11-05_12.16.54.mp4

After:

toggle-button-grow-2024-11-05_12.16.11.mp4

The first use case for this is displaying a badge with the amount of items in the listbox, in the LMS dashboard filters.

Without this, we can only display the badge right after the text, and this would allow to "push" this badge to the end, right before the chevron.

It may be possible to work around this limitation applying other CSS properties in consuming code, but I haven't found one which works consistently and doesn't feel a bit hackier than this.

@acelaya acelaya requested a review from robertknight November 5, 2024 11:18
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me.

@acelaya acelaya merged commit 986c9d5 into main Nov 5, 2024
4 checks passed
@acelaya acelaya deleted the select-button-grow branch November 5, 2024 11:32
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.

2 participants