Developer Docs - Helix - Creating New Controls
Lava shortcodes, acting as controls, streamline the process of rendering form elements, making them more efficient to use.
When considering creating new controls, evaluate whether they're broadly applicable or specific to your project. If you believe a control could benefit the toolkit, let's collaborate. We can either integrate it directly or assist you in submitting a pull request.
Patterns
Most new controls are developed from the `rock-control` base shortcode, which offers the necessary label and control group for a wide range of controls. Utilizing this pattern is advantageous as it prevents redundancy in the basic structure of your control and ensures updates can be made centrally.
Below is an example of using the rock-control shortcode from the dropdown control.
{[ rockcontrol id:'rc-{{ '' | UniqueIdentifier }}' label:'{{ label }}' type:'{{ type }}' isrequired:'{{ isrequired }}' validationmessage:'Please select a campus.' ]}
{[ endrockcontrol ]}
In most cases you'll want your control to provide the following parameters:
When using the rock-control shortcode you'll need to provide the UI element between the tags (lines 2-8 above).