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

[Button] Add three-valued button #40736

Open
1 task done
sergeyprokhorenko opened this issue Jan 22, 2024 · 3 comments
Open
1 task done

[Button] Add three-valued button #40736

sergeyprokhorenko opened this issue Jan 22, 2024 · 3 comments
Assignees
Labels
component: toggle button This is the name of the generic UI component, not the React module! new feature New feature or request waiting for 👍 Waiting for upvotes

Comments

@sergeyprokhorenko
Copy link

sergeyprokhorenko commented Jan 22, 2024

Search keywords

three-valued button checkbox

Latest version

  • I have tested the latest version

Summary

The three-valued button represents a control that implements the three-valued logic.

Three-valued button states

The true state is equivalent to the checked state of the checkbox.
The unknown state is equivalent to the unchecked state of the checkbox.
The false state has no equivalent for the checkbox. This state means prohibition of the specified search criterion.
The all state is equivalent to the undefined state of the checkbox.

These states must be looped (but it is preferable to use a dropdown list/menu of states):

  • unknown -> true -> false -> unknown
  • all -> true -> false -> unknown -> all (for group button)

Examples

There are only homemade solutions now that are similar to my proposal, for example, in Nigma search engine:
Nigma

Motivation

This new feature should be used instead of a checkbox, for example, to apply or prohibit the specified search criterion from a list of criteria.

@sergeyprokhorenko sergeyprokhorenko added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 22, 2024
@zannager zannager added component: checkbox This is the name of the generic UI component, not the React module! component: button This is the name of the generic UI component, not the React module! component: ButtonGroup The React component. labels Jan 22, 2024
@mj12albert mj12albert added new feature New feature or request waiting for 👍 Waiting for upvotes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer component: button This is the name of the generic UI component, not the React module! component: ButtonGroup The React component. labels Jan 24, 2024
@mj12albert
Copy link
Member

@sergeyprokhorenko Material UI checkboxes already support 3 states - checked (true), unchecked (false), and indeterminate or mixed (which would correspond to your unknown state)

For the 4th visual state ("all") you are proposing, do you have some more examples of this in the wild? (It could be a simple customization in userland but I'm just thinking out loud)

It could also be addressed by: mui/base-ui#24

@sergeyprokhorenko
Copy link
Author

sergeyprokhorenko commented Jan 24, 2024

@mj12albert I can't agree with you. See this article: Indeterminate checkboxes are weird

You will never see an individual checkbox in the indeterminate state. But it is the unchecked state that means the absence of any conditions or requirements. The unchecked state means unknown, and not prohibited. Therefore, it is necessary to add a prohibiting state false.

The indeterminate state does not refer to any one individual checkbox. It refers only to a group checkbox and means that the checkboxes in the group can be in any state. I call this state all (states of buttons in the group).

@sergeyprokhorenko
Copy link
Author

Three-valued button states (variant)

@mj12albert mj12albert changed the title Add three-valued button [Button] Add three-valued button Dec 5, 2024
@mj12albert mj12albert added component: toggle button This is the name of the generic UI component, not the React module! and removed component: checkbox This is the name of the generic UI component, not the React module! labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: toggle button This is the name of the generic UI component, not the React module! new feature New feature or request waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

3 participants