View Source LiveViewUI (LiveViewUI v0.0.2)
Provides utility functions for handling UI elements within LiveView components.
Summary
Functions
Converts a list of CSS class names into a single string with unique classes only.
Generates a unique identifier for a LiveView component.
Functions
Converts a list of CSS class names into a single string with unique classes only.
Parameters
classes
: A list of strings representing CSS class names, potentially with duplicates.
Examples
iex> LiveViewUI.cn(["button", "active", "button"])
"active button"
Returns
- A string containing unique class names, sorted and joined by spaces.
Generates a unique identifier for a LiveView component.
Examples
# Example of a typical unique identifier output
iex> id = LiveViewUI.unique_id()
iex> String.starts_with?(id, "LV")
true
iex> byte_size(id)
6
Returns
- A string starting with "LV" followed by a unique alphanumeric sequence.