View Source ExClsx (ex_clsx v1.0.0)
An utility module to concatenate strings fragments, filtering falsey values. Inspired to https://github.com/lukeed/clsx, it is useful to produce class names for components that depend on component attributes.
Link to this section Summary
Functions
Resolves a class names from a list of fragments. Supports string, maps and boolean values. Falsey values are automatically discarded.
Link to this section Functions
Resolves a class names from a list of fragments. Supports string, maps and boolean values. Falsey values are automatically discarded.
examples
Examples
iex> ExClsx.clsx(["hello", "world"]) "hello world"
iex> ExClsx.clsx(["hello", false, 0, nil, "world"]) "hello world"
iex> ExClsx.clsx(["please", %{ keep: true, discard: false }]) "please keep"
iex> ExClsx.clsx(["please", %{ "keep" => true, "discard" => false }]) "please keep"