helloflask / bootstrap-flask

Bootstrap 4 & 5 helper for your Flask projects.
https://bootstrap-flask.readthedocs.io
Other
1.12k stars 190 forks source link

How to add icon to submit button? #209

Open PanderMusubi opened 2 years ago

PanderMusubi commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

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

Technetium1 commented 1 year ago

@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