BitstylesPhoenix.Helper.Classnames (bitstyles_phoenix v2.3.0) View Source

The very best of NPM, now for elixir.

Link to this section Summary

Functions

Concatenates lists of class names, with trimming and conditionals.

Link to this section Functions

Link to this function

classnames(arg, opts \\ [backwards_compatible: true])

View Source

Concatenates lists of class names, with trimming and conditionals.

Classes prefixes with e2e- are removed by default. This behaviour can be configured with the trim_e2e_classes configuration. Check BitstylesPhoenix top level documentation for more information on configuration options.

Examples

iex> classnames("foo")
"foo"

iex> classnames("e2e-out")
false

iex> classnames(nil)
false

iex> classnames("  foo    ")
"foo"

iex> classnames("  foo bar  ")
"foo bar"

iex> classnames(["foo", "bar"])
"foo bar"

iex> classnames(["foo", "bar baz"])
"foo bar baz"

iex> classnames(:foo)
"foo"

iex> classnames({"foo", 1 == 1})
"foo"

iex> classnames({"foo", 1 == 2})
false

iex> classnames(["  foo  boing  ", {"bar", 1 == 2}, :baz])
"foo boing baz"