PhxComponentHelpers.set_prefixed_attributes
You're seeing just the function
set_prefixed_attributes
, go back to PhxComponentHelpers module for more information.
Extends assigns with prefixed attributes that can be interpolated within your component markup. It will automatically detect any attribute prefixed by any of the given prefixes from input assigns.
Can be used for intance to easily map alpinejs
html attributes.
Parameters
assigns
- your component assignsprefixes
- a list of prefix as binaries
Options
:init
- a list of attributes that will be initialized if absent from assigns:required
- raises if required attributes are absent from assigns
Example
assigns
|> set_prefixed_attributes(["@click", "x-bind:"], required: ["x-bind:class"])
assigns
now contains @html_click
and @html_x-bind:class
.