Material-components-web-components: Add fullwidth to mwc-button

Created on 5 Sep 2019  路  2Comments  路  Source: material-components/material-components-web-components

I'm submitting a:

  • [ ] bug report
  • [x] feature request

Current behavior:
mwc-button needs width set to width: 100% to occupy the entire space

Expected behavior:
mwc-textfield has a fullwidth property to handle this behavior, does it make sense to add something like this to mwc-button?

Comparison mwc-button vs mwc-textfield:

      <style>
        mwc-button {
          width: 100%;
        }
      </style>

      <mwc-textfield fullwidth label="Standard"></mwc-textfield>
      <mwc-button label="Sign up via Email"></mwc-button>
Button Feedback Requested Spec Question Styling Feature

Most helpful comment

Certainly very common in dialogs/forms, yes.

Another use case might be e. g. on a login form or any form that requires full-width expansion (basically any form on mobile).

So I guess the question is rather if it makes sense to do it via property or CSS. I think fullwidth property is the quick fix that works for most cases but sometimes a developer might want to do responsive custom CSS styles instead.

Tbh I would have just done width: 100% but since I knew textfield already had it, I expected the button component to have it as well.

All 2 comments

Is this fullwidth property something you'd need in a dialog or form?

Certainly very common in dialogs/forms, yes.

Another use case might be e. g. on a login form or any form that requires full-width expansion (basically any form on mobile).

So I guess the question is rather if it makes sense to do it via property or CSS. I think fullwidth property is the quick fix that works for most cases but sometimes a developer might want to do responsive custom CSS styles instead.

Tbh I would have just done width: 100% but since I knew textfield already had it, I expected the button component to have it as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfreedm picture dfreedm  路  3Comments

eskan picture eskan  路  4Comments

frankiefu picture frankiefu  路  4Comments

pandres95 picture pandres95  路  4Comments

bennypowers picture bennypowers  路  4Comments