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

New Component: MultiStateCheckbox #1812

Closed
NathanPB opened this issue Feb 15, 2021 · 6 comments
Closed

New Component: MultiStateCheckbox #1812

NathanPB opened this issue Feb 15, 2021 · 6 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@NathanPB
Copy link
Contributor

I'm submitting a ... (check one with "x")

[ ] bug report
[ x ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

I'm actively using Primereact and I'm in need of a checkbox-like component where users can keep clicking to cycle between the icon of a globe, an open keylock and a closed keylock. In my context this mean that some information should be public, private or visible only to friends.

I know I could use a tri state checkbox, but what if someone else finds into a problem where the need is to have four or more possible values?

I'd expect a component that can be used with a syntax like this:

<MultiCheckbox value={...}, onChange={...} ...>
  <MultiCheckbox.Option value={0} icon="pi pi-globe"/>
  <MultiCheckbox.Option value={1} icon="pi pi-open-lock"/>
  <MultiCheckbox.Option value={2} icon="pi pi-lock"/>
</MultiCheckbox>

And it will baheve like a checkbox, going to the next value when clicked (order of the JSX elements) and rendering the icon that is specified.

There will also be another boolean prop on MultiCheckbox.Option named something like "eligible". Default is true, but if false this will make the checkbox "skip" this option and don't make it selectable at all.

Also, there may be all the other common props like id, className, style, readOnly, etc...

If you guys think that this is a good idea I wanna state that I can send a PR for PrimeReact implementing this component (may need help building the docs but whatever).

Thank you so much for considering this idea, this will surely make prime an even richer and more complete UI kit.

Regards, Nathan

NathanPB added a commit to NathanPB/primereact that referenced this issue Feb 15, 2021
NathanPB added a commit to NathanPB/primereact that referenced this issue Feb 15, 2021
@NathanPB
Copy link
Contributor Author

I'm doing it anyway 😝 . Working version already available in my fork

NathanPB added a commit to NathanPB/primereact that referenced this issue Feb 16, 2021
NathanPB added a commit to NathanPB/primereact that referenced this issue Feb 16, 2021
@mertsincan
Copy link
Member

Hi @NathanPB,
I'm so sorry for the late reply. I did not notice this issue and PR. It seems like a very useful component in my opinion. Thank you very much for your effort. But I have to talk to my team and decide. If my team approves, I would be grateful if I get a new PR from you ;)

Thanks again for your contribution and hard work!

@NathanPB
Copy link
Contributor Author

No problem man, I noticed the long time it was taking but I thought you all were just busy with other stuff. Hope I can get this added to primereact. I have some use cases for that just waiting for the PR, probably someone else has too =)

@NathanPB
Copy link
Contributor Author

Btw I closed it on accident by deleting the branch, will redo tomorrow

@mertsincan
Copy link
Member

Thanks a lot for your understanding! I promise to add comments to your PR :D

@mertsincan mertsincan changed the title Multi state checkbox New Component: MultiStateCheckbox Apr 14, 2021
@mertsincan mertsincan added the Type: New Feature Issue contains a new feature or new component request label Apr 14, 2021
@mertsincan mertsincan added this to the 6.2.2 milestone Apr 14, 2021
@mertsincan mertsincan reopened this Apr 14, 2021
@mertsincan mertsincan added the Status: In Progress Core Team is working on the issue or pull request label Apr 14, 2021
mertsincan added a commit that referenced this issue Apr 15, 2021
@mertsincan mertsincan removed the Status: In Progress Core Team is working on the issue or pull request label Apr 15, 2021
@mertsincan
Copy link
Member

@NathanPB, Thanks again ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

2 participants