PhxComponentHelpers.set_component_attributes
You're seeing just the function
set_component_attributes
, go back to PhxComponentHelpers module for more information.
Extends assigns with raw_* attributes that can be interpolated within your component markup.
Parameters
assigns
- your component assignsattributes
- a list of attributes (atoms) that will be fetched from assigns
Options
:required
- raises if required attributes are absent from assigns:json
- when true, will JSON encode the assign value:into
- merges all assigns in a single one that can be interpolated at once
Example
assigns
|> set_component_attributes([:id, :name, :label], required: [:id, :name], into: :attributes)
|> set_component_attributes([:value], json: true)
assigns
now contains @raw_id
, @raw_name
, @raw_label
and @raw_value
.
It also contains @raw_attributes
which holds the values if :id
, :name
and :label
.