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

Buttons, links styled as classes instead of elements #352

Open
keiranking opened this issue Oct 22, 2019 · 1 comment
Open

Buttons, links styled as classes instead of elements #352

keiranking opened this issue Oct 22, 2019 · 1 comment
Labels

Comments

@keiranking
Copy link
Contributor

Bitters' default <button> and <a> styles are very useful. However, it's often the case that you want an HTML button to visually appear as a link, or vice versa, which forces CSS to undo CSS, like this 33-line monster:

.button-link {
  appearance: none;
  background-color: transparent;
  border-radius: none;
  color: $action-color;
  display: inline;
  font-family: $base-font-family;
  font-size: inherit;
  -webkit-font-smoothing: antialiased;
  font-weight: inherit;
  line-height: $base-line-height;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  transition: none;
  user-select: auto;
  vertical-align: middle;
  white-space: normal;

  &:hover {
    background-color: transparent;
    color: shade($action-color, 25%);
  }

  &:disabled {
    cursor: not-allowed;
    opacity: 0.5;

    &:hover {
      background-color: transparent;
    }
  }
}

I wrote that code, and I'm a worse person because of it.

Opt-in button and link classes might:

  • prevent writing CSS to undo CSS
  • allow button and link UI to be more intentional
  • shift one of the more opinionated areas of Bitters to a more opinionated choice—a class

However, introducing classes in Bitters would represent a major philosophical change.

@tysongach
Copy link
Contributor

However, introducing classes in Bitters would represent a major philosophical change.

I think it would be worthwhile for us to explore this. Bitters having only element styles has been a “soft” feature or intention (from my perspective). I’m not sure we’ve ever fully explained or documented why that is and so it feels open to interpretation and iteration. I am very keen on not limiting ourselves to just element styles and would be fine with classes existing here.


@keiranking Bitters aside, do you have a preferred means of tackling what you describe above? In a perfect situation, what’s your ideal way of styling buttons?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants