Skip to content

Instantly share code, notes, and snippets.

@gjain574
Created July 16, 2020 11:25
Embed
What would you like to do?
{% macro CustomInput(label) %}
<div class="form-group">
<label class="abc-c-form__label" for="">{{ label }}</label>
<input class="abc-c-form__controller form-control" type="input">
</div>
{% endmacro %}
{% macro CustomInput(label, additional_classes) %}
<div class="form-group">
<label class="abc-c-form__label" for="">{{ label }}</label>
<input class="abc-c-form__controller form-control {{ additional_classes|join(" ") }}" type="input">
</div>
{% endmacro %}
{% macro CustomInput(label, additional_classes, attrs) %}
<div class="form-group">
{% set attributes = '' %}
{% for key, attr in attrs %}
{% set attributes = attributes ~ key ~ '=' ~ attr ~ ' ' %}
{% endfor %}
<label class="abc-c-form__label" for="">{{ label }}</label>
<input class="abc-c-form__controller form-control {{ additional_classes|join(" ") }}" type="input" {{attributes}} >
</div>
{% endmacro %}
{{ CustomInput("Custom Label") }}
{{ CustomInput("Custom Label", ["datepicker", "d-block"]) }}
{% set attrs =
{
"placeholder" : "Custom Input Goes Here",
"id" : "12",
"style" : "padding-top:10px;"
}
%}
{{ CustomInput("Custom Label", ["datepicker", "d-block"], attrs) }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment