FlintUI.API.Classes (FlintUI v0.1.0)
CSS class helpers.
Summary
Functions
Builds a class string, concatenates a class string, out of a list of
Functions
Link to this function
cx(classes)
Builds a class string, concatenates a class string, out of a list of:
- Strings;
- Atoms;
- Keyword lists or maps where the keys are the CSS class and the values are treated as booleans for conditional inclusion of the class.
All nil
, false
and duplicated values are filtered out.
Examples
iex> cx(["foo", "bar"])
"foo bar"
iex> cx([foo: false, bar: true])
"bar"
iex> cx([[a: true, b: false], [c: false, d: true]])
"a d"
iex> cx(["one", :two])
"one two"
iex> cx(yes: true, no: false)
"yes"
iex> cx(%{"a" => true, b: false})
"a"
iex> cx(t: "I'm truthy", f: nil)
"t"
iex> cx([[[nil, false, "hello", :world]]])
"hello world"