Material Design Lite Buttons
what is buttons in (MDL) ?
- Material Design Lite(MDL) component button is used to create an enhanced button .
- The button may contain, text, images to show the purpose of button, or response on user clicks.
- Material Design provides mulitple classes to create various types of buttons.Like flat, raised , fab and icon etc.
- The below table mentions the available classes and their effects.
S.N. | Class Name & Description |
---|---|
1 | mdl-button Sets button as an MDL component, required. |
2 | mdl-js-button Adds basic MDL behavior to button, required. |
3 | (none) Sets flat display effect to button, default. |
4 | mdl-button--raised Sets raised display effect, can be used mutual exclusively with fab, mini-fab, and icon. |
5 | mdl-button--fab Sets fab (circular) display effect, can be used mutual exclusively with raised, mini-fab, and icon. |
6 | mdl-button--mini-fab Sets mini-fab (small fab circular) display effect,can be used mutual exclusively with raised, fab, and icon. |
7 | mdl-button--icon Sets icon (small plain circular) display effect, can be used mutual exclusively with raised, fab, and mini-fab. |
8 | mdl-button--colored Sets colored display effect where the colors are defined in material.min.css. |
9 | mdl-button--primary Sets primary color display effect where the colors are defined in material.min.css. |
10 | mdl-button--accent Sets accent color display effect where the colors are defined in material.min.css. |
11 | mdl-js-ripple-effect Sets ripple click effect, can be used in combination with any other classes. |
Material Design Lite (MDL) Buttons : Creating Fab Buttons
- A Fab button is created using "mdl-button--fab".
- To create a fab button with ripple effect use class "mdl-js-ripple-effect"
- To disable the button using the attribute with buttons
Sample code:
Material Design Lite(MDL) Buttons : Fab Buttons with Colors
- To create a MDL button with Fab Effect with colors use class mdl-button--colored along with a Fab Button.
Sample code:
Material Design Lite(MDL) Buttons : Raised Button
- A Raised MDL Button is created using the class mdl-button--raised along , all other effects are applied using usual CSS classes.
Sample code:
Material Design Lite(MDL) : Raised Buttons with Colors
- A Raised button with colors can be created using mdl-button--colored along to apply the colored display effect, the default color is primary defined with material.min.css.
Sample code:
Material Design Lite(MDL) : Flat Buttons
- A Flat MDL Button is created by default, no additional CSS class needed, except the button component.
Sample code:
Material Design Lite(MDL) : Flat Buttons with Colors
- A Color to the Flat Button is applied using class mdl-button--primary to apply the primary color.
Sample code:
Material Design Lite(MDL) : Icon Buttons with Colors
- To create an Icon Button use class mdl-button--icon to apply a plain circular display effect.
- The demo below has a badge within a link, outside the link , badge within a link with no background color.
Sample code:
Material Design Lite(MDL) : Small Fab Buttons
- A Small MDL button with Fab Effect can be created using class mdl-button--mini-fab