Skip to content

Indeterminate support for options in a checkbox group #1788

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

Closed
1 task done
wmjasonward opened this issue Feb 15, 2020 · 3 comments
Closed
1 task done

Indeterminate support for options in a checkbox group #1788

wmjasonward opened this issue Feb 15, 2020 · 3 comments
Labels

Comments

@wmjasonward
Copy link

wmjasonward commented Feb 15, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

We have a use case where I need two checkbox groups that are related. Selecting one item in the first checkbox group, implies the inclusion of some items in the second checkbox group. The items in the second group haven't been explicitly selected, so I don't want to show them as checked. But, I do want to indicate that they are implicitly included so I'd like to use the 'indeterminate' state to represent this.

What does the proposed API look like?

I'd like to be able to set { indeterminate: true } on the options for the checkbox group.

const optionsWithIndeterminate = [
{ value: 'Apple' },
{ label: 'Pear', value: 'Pear' },
{ label: 'Orange', value: 'Orange', indeterminate: true },
];

It appears this could be implemented by adding the following line to components/checkbox/Group.jsx at approx line 83:

indeterminate={'indeterminate' in option ? option.indeterminate : false}

or, if it would also be desirable to add the indeterminate property to the entire Checkbox Group:

indeterminate={'indeterminate' in option ? option.indeterminate : props.indeterminate}

My work-around is to create a list of Checkboxes inside the CheckboxGroup, so this is really just a matter of convenience.

Thanks!

@tangjinzhou tangjinzhou added Accept You are right, we should do that enhancement help wanted labels Feb 16, 2020
@tangjinzhou
Copy link
Member

We should use provide. You can submit pr to add it.

@github-actions
Copy link

github-actions bot commented Jan 4, 2021

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants