
This module implements a Material design theme for all widgets.
The stylings are following the official Material Design guidelines as close as possible. Please use these widgets in combination with the official guidelines.
The typograpahy is taken from the material design guidelines. Its recommended to use a font size of 16px width and the Roboto Font.
The style are not opaque, so you can change every styling to your needs.
If you have any suggestions or improvements, be sure to leave a PR or a Issue over at the github repos.
You can use the theme by copying the following code:
type alias Style msg =
{ dialog : DialogStyle msg
, expansionPanel : ExpansionPanelStyle msg
, button : ButtonStyle msg
, primaryButton : ButtonStyle msg
, tab : TabStyle msg
, textInput : TextInputStyle msg
, chipButton : ButtonStyle msg
, row : RowStyle msg
, buttonRow : RowStyle msg
, column : ColumnStyle msg
, cardColumn : ColumnStyle msg
, sortTable : SortTableStyle msg
, selectButton : ButtonStyle msg
, progressIndicator : ProgressIndicatorStyle msg
, layout : LayoutStyle msg
}
sortTable : Palette -> SortTableStyle msg
sortTable palette =
{ containerTable = []
, headerButton = Material.textButton palette
, ascIcon = Icons.chevronUp |> Element.html |> Element.el []
, descIcon = Icons.chevronDown |> Element.html |> Element.el []
, defaultIcon = Element.none
}
style : Palette -> Style msg
style palette =
{ sortTable = sortTable palette
, row = Material.row
, buttonRow = Material.buttonRow
, cardColumn = Material.cardColumn palette
, column = Material.column
, button = Material.outlinedButton palette
, primaryButton = Material.containedButton palette
, selectButton = Material.toggleButton palette
, tab = Material.tab palette
, textInput = Material.textInput palette
, chipButton = Material.chip palette
, expansionPanel = Material.expansionPanel palette
, dialog = Material.alertDialog palette
, progressIndicator = Material.progressIndicator palette
, layout = Material.layout palette
}Different styles for buttons have different meanings.
textButton as your default buttoncontainedButton for any important actionoutlinedButton if you have more then one important action.
Use containedButton for the most important action of the group.A contained button representing the most important action of a group.
A outlined button representing an important action within a group.
A text button representing a simple action within a group.
An single selectable icon.
Technical Remark:
A ToggleButton. Only use as a group in combination with buttonRow.
Toggle buttons should only be used with the iconButton widget, else use chips instead.
Technical Remark:
a Row of buttons.
Only use in combination with toggleButton
A boolean switch
Technical Remark:
In the material design specification the card is not really specified at all. Im practice the List seams more useful then a own card widget. Thus for now we only provide a card containing a list.
A List styled like a card.
Technical Remark:
This is a simplification of the Material Design Card and might get replaced at a later date.
Chips have the same behaviour as buttons but are visually less important.
In the official documentation chips have different names depending on where they are used:
textInput for this feature.toggleButton for icons with no text and chips for text with no icons.Technical Remark:
A text input style that is included only to support input chips.
Technical Remark:
An alert dialog for important decisions. Use a snackbar for less important notification.
The expansion Panel is an outdated part of the material design specification. In modern implementation it gets replaced with a very sophisticated list widget.
Technical Remarks:
The List widget is a very complex widget that sadly only particially made it into this package.
A simple styling for a row.
A simple styling for a column.
A circular progress indicator
A typical snackbar
Technical Remark:
A Tab bar meant for only the upper most level. Do not use a tab within a tab.
A single Tab button.
Technical Remark:
The Layout Widget combines the following Material design concepts:
Future updates might try to seperate them into there own widgets. But for now they are only available as an all-in-one solution.
Technical Remark:
To create your own Material Widgets, here are all internal functions. Note that you might want to checkout the file on GitHub if you want to tweak some internal behaviour.
The material design comes with customizable color palettes.
Check out the official documentation about the color system to see how these colors are used.
For the
-oncolors you can use white, for transitions into white, or black,for transitions into black. Other colors are also possible, but i've not seen any website acutally using a different color.