google / material-design-lite

Material Design Components in HTML/CSS/JS
https://getmdl.io
Apache License 2.0
32.28k stars 5.03k forks source link

Why are mdl-data-table td right aligned by default? #5020

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi,

Are tables expected to hold numeric data generally? I saw that the MD guidelines recommend right align for numeric but left align for text. With this library by default it behaves for numeric data, one has to explicitly apply class mdl-data-table__cell--non-numeric for text, so I'm wondering why the default is not the other way around. In my case most of my tables hold text and I'm having to litter the code with the explicit classing. I wonder if this is not most peoples use case too? Thanks in advance.

Garbee commented 7 years ago

It's probably just from where whomever was doing the original build saw all the examples in the specification were largely numeric. There isn't a decided rhyme-or-reason to it. For Material Components for Web's table we should probably just let text be the default and numeric be the modifier.

harobed commented 6 years ago

Components for Web's table we should probably just let text be the default and numeric be the modifier.

Or use class on <table> to configure the cell default behavior: numeric or text.

harobed commented 6 years ago

Or use class on <table> to configure the cell default behavior: numeric or text.

Something like:

  .mdl-data-table.mdl-data-table-default-non-numeric td {
    text-align: left;
  }

and

        <table class="mdl-data-table mdl-js-data-table mdl-data-table-default-non-numeric">
...