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

Select component: add a suffix to .form-control-input #2063

Merged

Conversation

newdigate
Copy link
Contributor

We added a suffix (part, slot) to the select component

Having the suffix slot/part allows us to make the suffix in the select component consistent with the suffix in our sl-input components.

I think this feature will be useful for other projects too.

Many thank you for such an amazing, awe-inspiring component library! I hope this change is helpful for you :)

Copy link

vercel bot commented Jun 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
shoelace ✅ Ready (Inspect) Visit Preview Jun 11, 2024 4:27pm

@claviska
Copy link
Member

claviska commented Jun 11, 2024

I believe @lindsaym-fa's comment from the previous PR applies here.

Thanks for the PR, @newdigate! I'd love to know more about your use case. Would you be willing to share screenshots or more info about how you use suffix icons in select elements?

#2062 (comment)

@newdigate
Copy link
Contributor Author

Hi, @lindsaym-fa

We have a suffix in the dropdown component which we use as a button for the user to change their dropdown preferences:
image

We are looking to have the same suffix feature in the select component
image

@newdigate
Copy link
Contributor Author

@claviska, @lindsaym-fa
A better example is this:

The input component has prefix and suffix:
image

However the select component only has a prefix:
image

We required the select component to also have a suffix part. From our perspective, this is more consistent.

@lindsaym-fa
Copy link
Collaborator

Thank you, @newdigate. 🙏 We appreciate the clean PR, but we're hesitant to bring this feature into the library. Importantly, prefix and suffix slots are intended to be presentational and haven't been vetted for use with interactive controls. Our concern is that introducing a presentational suffix competes unnecessarily with sl-select's caret and is prone to poor UX. (This isn't necessarily a reflection of your use case, but the general risks.)

@newdigate
Copy link
Contributor Author

hi @lindsaym-fa

here is a non-interactive use-case:

we have a select component and we want to indicate the selected user is out-of-office:
image

image

@lindsaym-fa
Copy link
Collaborator

Ah! That's a neat one. If we tailored the docs for a use case like this, I'd be happy to support a suffix slot.

We also recently had a discussion (#2053) about better documenting support for presentational text in prefix and suffix slots. @claviska, what do you think?

@claviska
Copy link
Member

It's a compelling use case, for sure. Like you said, as long as the docs are updated to reflect it.

@martinemmert
Copy link

I came here to search for the same thing. Having a Prefix Slot to add further presentational content for our users would enable us to rebuild this Select2 select element with Shoelaces.
image

Copy link
Member

@claviska claviska left a comment

Choose a reason for hiding this comment

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

Thanks for the great use case! We'll get the docs updated and get this one in for the next release.

@lindsaym-fa lindsaym-fa merged commit 4f5ac7b into shoelace-style:next Jul 29, 2024
2 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.

4 participants