bootstrap-flask icon indicating copy to clipboard operation
bootstrap-flask copied to clipboard

How to add icon to submit button?

Open PanderMusubi opened this issue 3 years ago • 3 comments

I have a form with

submit = SubmitField('Search')

and a template with

{{ render_field(form.submit) }}

which renders to

<input class="btn btn-primary btn-lg btn-block" id="submit" name="submit" type="submit" value="Search">

but I want the search icon on the submit button instead of the text Search. Anybody know how to do this? Thanks.

PanderMusubi avatar Feb 09 '22 14:02 PanderMusubi

This works, but I hope it can be done in a shorter way

<button class="btn btn-primary btn-lg btn-block" id="submit" name="submit" type="submit" value="Search">{{ render_icon('search') }}</button>

PanderMusubi avatar Feb 09 '22 14:02 PanderMusubi

If there is no alternative way or supporting this in our implementation, okay I add this to our documentation?

PanderMusubi avatar Feb 19 '23 12:02 PanderMusubi

@PanderMusubi It is documented here: https://bootstrap-flask.readthedocs.io/en/stable/macros/#render-icon

Please add support for overriding fill color to it: https://github.com/helloflask/bootstrap-flask/blob/ed59d2a49220ce46e0171401f755f579c7cababf/flask_bootstrap/templates/base/utils.html#L13-L21

Technetium1 avatar Jun 05 '23 21:06 Technetium1