Closed amorey closed 8 years ago
I think I like it. Are you planning on keeping both forms? or move to just data attributes?
Great, thanks for the feedback! I think it should be either/or to keep the css simple. I'll put together some more examples so we can evaluate.
Here are some more examples of MUI components with data-attributes syntax. Let me know what you think!
<div class="mui-container-fluid"></div>
<div class="mui-container" data-mui-fluid="true"></div>
<div class="mui-text-display4 mui-text-white"></div>
<div class="mui-text-display4" data-mui-color="white"></div>
<div class="mui-dropdown">
<button class="mui-btn mui-btn-primary" data-mui-toggle="dropdown">Dropdown</button>
<ul class="mui-dropdown-menu mui-dropdown-menu-right">
<li><a>Option 1</a></li>
<li><a>Option 2</a></li>
</ul>
</div>
<div class="mui-dropdown">
<button class="mui-btn" data-mui-color="primary" data-mui-toggle="dropdown">Dropdown</button>
<ul class="mui-dropdown-menu" data-mui-align="right">
<li><a>Option 1</a></li>
<li><a>Option 2</a></li>
</ul>
</div>
<table class="mui-table mui-table-bordered"></table>
<table class="mui-table" data-mui-borders="true"></table>
<div class="mui-divider-top"></div>
<div class="mui-divider" data-mui-position="top"></div>
:+1:
I actually prefer the old way, only because it's in line with most of the other frameworks that I know.
@igitur Thanks for the feedback!
The old way was defined by Bootstrap before data-attributes became popular so I think it's worth considering if data-attributes might make the syntax better. The main benefits I see are:
mui-btn
) and options (data-mui-style="flat"
)class="mui-dropdown-menu-right"
vs. data-mui-align="right"
)data-mui-toggle="dropdown"
)I like the idea of using data-attributes for overriding class defaults. On Aug 20, 2015 7:43 AM, "Andres Morey" notifications@github.com wrote:
@igitur https://github.com/igitur Thanks for the feedback!
The old way was defined by Bootstrap before data-attributes became popular so I think it's worth considering if data-attributes might make the syntax better. The main benefits I see are:
- Separation between component identifier (mui-btn) and options ( data-mui-style="flat")
- More explicit behavior (class="mui-dropdown-menu-right" vs. data-mui-align="right")
- Consistency with other JS attributes (e.g. data-mui-toggle="dropdown")
— Reply to this email directly or view it on GitHub https://github.com/muicss/mui/issues/41#issuecomment-133011691.
As a next step I'll put together a more formal proposal so we can take a look at the syntax.
Here's a more formal proposal for using data-attributes to override class defaults. The scope is limited to classes which define components (e.g. buttons, tables). I think we can support both syntax styles for a little while to give developers a chance to migrate.
The following is the list of components and options (written in a JSDoc-like syntax):
.mui-container
{Boolean} fluid=false - If true, container expands to fit viewport
.mui-btn
{String} color=normal - Button color (normal|primary|danger|accent)
{String} style=normal - Button style (normal|raised|flat|fab)
{String} size=normal - Button size (normal|large|small)
.mui-dropdown-menu
{String} align=left - Menu text alignment (left|right)
.mui-table
{Boolean} borders=false - If true, table cells have borders (false|true)
Let me know what you think! In particular, I'd love some feedback on attribute names and values.
Everyone - we're very close to merging the data-attributes branch into master. These are the questions that need to get figured out first:
What should the default value of button color
/style
/size
attributes be called?
Currently, the default value for all three is "normal". Here are some other possibilities:
.mui-btn
{String} color=normal|default|white
{String} style=normal|default
{string} size=normal|default|medium
I'm hesitant to use the label "default" because it has a double meaning in this context and we're not using it in other places.
What should the value of the button style
attribute be for "floating action buttons"?
Currently you can create a floating action button by specifying style="fab"
. Another possibility is style="round"
. One drawback of style="round"
is that it's not clear that a round button should have a non-zero z-index which floating action buttons do have. Does anyone have any thoughts on "fab" vs. "round" and whether or not round buttons should have a default z-index?
How should we handle large/small button sizes that aren't in the Material Design spec?
Currently the Material Design guidelines don't have a spec for "small" rectangular buttons and "large" floating action buttons. Also, small floating action buttons are called "mini". Does anybody have any strong feelings on whether we should use "large"/"small" naming scheme and add support for non-standard sizes to MUI?
white
as it is confusing. I prefer default
- not sure that I see the confusion. Maybe base
?floating
? fab
is probably fine...small
and large
are the most obvious names to use; though I'm not sure I would add small/large sizes to begin with.Great, thanks for the feedback.
Three. I didn't see the large
reference for rectangular buttons; just the mini
for floating action buttons. Odd that they don't allow both on either. My preference would be mini | default or normal | large
for all button types.
(apparently Markdown won't let you start a list with an arbitrary number)
The data-attributes syntax is available for testing in v0.1.22-rc1: https://www.muicss.com/
Let me know if you run into any problems!
Here's another issue to consider: data-attributes aren't supported in some popular email clients (e.g. Outlook and GMail) so the MUI HTML Email library needs to keep using class syntax.
Is it ok that for the CSS/JS and Email libraries to use different syntaxes? Or is it preferable to use class syntax for both? Should we support both syntaxes in the CSS/JS library?
I like how clean the data-attributes syntax is but it would be great to support the same syntax in CSS/JS and Email.
@metatribal After thinking about it some more I think color
is confusing because the possible values are not actual colors. What do you think about using type
instead of color
?
Here are some examples of data-attributes type
/style
/size
in action:
https://github.com/muicss/mui/blob/react-bugfix/examples/buttons.html
https://github.com/muicss/mui/blob/react-bugfix/examples/react/buttons.html
https://github.com/muicss/mui/blob/react-bugfix/examples/webcomponents/buttons.html
Let me know what you think.
I agree, but am thinking style and type should be switched. E.g. style=primary, type=fab On Sep 23, 2015 9:53 PM, "Andres Morey" notifications@github.com wrote:
@metatribal https://github.com/metatribal After thinking about it some more I think color is confusing because the possible values are not actual colors. What do you think about using type instead of color?
Here are some examples of data-attributes type/style/size in action: https://github.com/muicss/mui/blob/react-bugfix/examples/buttons.html https://github.com/muicss/mui/blob/react-bugfix/examples/react/buttons.html
https://github.com/muicss/mui/blob/react-bugfix/examples/webcomponents/buttons.html
Let me know what you think.
— Reply to this email directly or view it on GitHub https://github.com/muicss/mui/issues/41#issuecomment-142801652.
Drat! I anticipate using common styling and layout between my application and support emails. Using two different means is ugly. If this is the case, I would probably opt to use just there classes. On Sep 19, 2015 10:22 AM, "Andres Morey" notifications@github.com wrote:
Here's another issue to consider: data-attributes aren't supported in some popular email clients https://www.campaignmonitor.com/css/ (e.g. Outlook and GMail) so the MUI HTML Email library needs to keep using class syntax.
Is it ok that for the CSS/JS and Email libraries to use different syntaxes? Or is it preferable to use class syntax for both? Should we support both syntaxes in the CSS/JS library?
I like how clean the data-attributes syntax is but it would be great to support the same syntax in CSS/JS and Email.
— Reply to this email directly or view it on GitHub https://github.com/muicss/mui/issues/41#issuecomment-141685025.
Re: style
vs type
- Yeah, that makes sense. I'll reverse them.
Re: Email css - Ok, I'll start thinking about reverting to class syntax :(. The attribute syntax will still be useful for React and WebComponents. Are you using the MUI Email CSS library for HTML emails?
Any thoughts on BEM syntax (e.g. mui-btn--primary
)?
this is a nice change @amorey
@mukuljp Which change are you referring to??
I am using it for email, but very limited. I would like to use it more.
Syntax is ok with me. On Sep 24, 2015 8:30 AM, "Andres Morey" notifications@github.com wrote:
Re: style vs type - Yeah, that makes sense. I'll reverse them.
Re: Email css - Ok, I'll start thinking about reverting to class syntax :(. The attribute syntax will still be useful for React and WebComponents. Are you using the MUI Email CSS library for HTML emails?
Any thoughts on BEM syntax (e.g. mui-btn--primary)?
— Reply to this email directly or view it on GitHub https://github.com/muicss/mui/issues/41#issuecomment-142946604.
Here's a preview of buttons with BEM syntax: https://github.com/muicss/mui/blob/bem-syntax/examples/buttons.html https://github.com/muicss/mui/blob/bem-syntax/examples/email/buttons.html
And here's BEM syntax for dropdowns: https://github.com/muicss/mui/blob/bem-syntax/examples/dropdowns.html
I'd be curious to hear your thoughts before I migrate the rest of the code base to BEM.
It's verbose, but looks consistent and readable. Can't think of a better alternative. On Sep 24, 2015 8:50 PM, "Andres Morey" notifications@github.com wrote:
Here's a preview of buttons with BEM syntax: https://github.com/muicss/mui/blob/bem-syntax/examples/buttons.html https://github.com/muicss/mui/blob/bem-syntax/examples/email/buttons.html
And here's BEM syntax for dropdowns: https://github.com/muicss/mui/blob/bem-syntax/examples/dropdowns.html
I'd be curious to hear your thoughts before I migrate the rest of the code base to BEM.
— Reply to this email directly or view it on GitHub https://github.com/muicss/mui/issues/41#issuecomment-143108544.
Here's a proposal for BEM syntax: https://github.com/muicss/mui/issues/47
Everyone - thanks for your feedback on the CSS syntax! In order to maintain compatibility with the email library and to maintain consistency and predictability we've settled on BEM syntax (https://github.com/muicss/mui/issues/49). Please check out the latest release candidate and let us know what you think.
Hi Everyone,
In some cases, using HTML classes to markup components feels awkward. One option is to use data-attributes instead. Here are some examples of what MUI markup would look like with data-attributes instead of classes:
Button colors
Classes:
Data-attributes:
Button styles
Classes:
Data-attributes:
Let me know your thoughts on data-attributes syntax!
Andres