I'd like to add a property to a tag generated by slim. For example:
<input type='text' name='name' required>
To create the HTML example you provided, your Slim would look like this:
= text_field_tag :name, required: 'required'
To add any additional attributes to the input
tag, you'd simply provide additional arguments to the text_field_tag
method. So if you wanted to specify the class
attribute, you could do:
= text_field_tag :name, required: 'required', class: 'really-nice-text-field'
This would also work:
= text_field_tag :name, required: true