Materialize v0.1.4-dev Materialize.Html
Helper for create HTML blocks
Before add module
alias Elixir.Materialize.Html
Example
Create link a:
Elixir.Materialize.Html.get_a("Link", "#", [class: "example"])
Elixir.Materialize.Html.get_a [text: "Link", attr: [href: "#", class: "example"]]
result
<a href="#" class="example">Link</a>
Create tag span:
Elixir.Materialize.Html.get_tag("span", "Text", [class: "example"])
Elixir.Materialize.Html.get_tag [tag: "span", text: "Text", attr: [class: "example"]]
result
<span class="example">Text</span>
Create list ul:
Elixir.Materialize.Html.get_list [tag: "ul", attr: [class: "example"], items: [
[text: "text"],
[tag: "a", text: "link", attr: [href: "#"]]
]]
result
<ul>
<li>text</li>
<li><a href="#">link</a></li>
</ul>
Summary
Functions
Create link a
Create link a
Get html attributes
Create list ul
Create tag span or etc
Create tag span or etc
Check if key exists and value is not empty
Functions
Create link a
Parameters
- item: keyword list
Example
Elixir.Materialize.Html.get_a [text: "Link", attr: [href: "#", class: "example"]]
Create link a
Parameters
- text: text link
- href: ulr link
- attr: keyword list
Example
Elixir.Materialize.Html.get_a("Link", "#", [class: "example"])
Get html attributes
Parameters
- item: keyword list
Example
Elixir.Materialize.Html.get_attribute [tag: "span", text: "Text", attr: [id: "abc", class: "example"]]
Result
id="abc" class="example"
Create list ul
Parameters
- item: keyword list
Example
Elixir.Materialize.Html.get_list [tag: "ul", attr: [class: "example"], items: [
[text: "text"],
[tag: "a", text: "link", attr: [href: "#"]]
]]
Create tag span or etc.
Parameters
- item: keyword list
Example
Elixir.Materialize.Html.get_tag [tag: "span", text: "Text", attr: [class: "example"]]
Create tag span or etc.
Parameters
- tag: tag, span, i, p … etc.
- text: text into tag
- attr: keyword list html attributes
Example
Elixir.Materialize.Html.get_tag("span", "Text", [class: "example"])