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 purpose property #3013

Open
mhsmith opened this issue Dec 3, 2024 · 1 comment
Open

Button purpose property #3013

mhsmith opened this issue Dec 3, 2024 · 1 comment
Labels
enhancement New features, or improvements to existing features.

Comments

@mhsmith
Copy link
Member

mhsmith commented Dec 3, 2024

Invent buttons have a purpose property which currently accepts the following options:

  • Default (i.e. no special style – this should probably be renamed to "normal" or something to avoid confusion with the concept of a "default button")
  • Primary
  • Secondary
  • Success
  • Warning
  • Danger

This is based on the list from PaperCSS, but Invent also intends to support other style frameworks, so the list is open to change.

Some of Toga's existing platforms support a similar concept, e.g. Apple calls it a "role".

The name of this property is TBD – "class" might be a more generic name, but it's a reserved word in Python.

@mhsmith mhsmith added the enhancement New features, or improvements to existing features. label Dec 3, 2024
@freakboy3742
Copy link
Member

A big +1 to this one. One of the main reasons we support background_color on buttons is to satisfy the use case of "making a button stand out"; but most platforms have the ability to make "warning" and "error" buttons that entail a specific platform appearance. "Purpose" is a much better to approach that problem.

By way of naming - a quick survey of existing API naming for this idea:

  • Invent: purpose
  • iOS/macOS: role
  • paperCSS: class (leaning directly on CSS)
  • bootstrap: class (again, leaning on CSS)
  • Shoelace: variant
  • Textual: variant

I couldn't find any native concept of this idea for GTK, Winforms, WinUI3 or Android/Material3.

This is (almost literally) a bike shed, and there's no clearly established precedent for the feature, so IMHO any of the names purpose, role or variant are perfectly cromulent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

2 participants