helloflask / bootstrap-flask

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

Allow extra classes on render_icon #336

Open ElSaico opened 8 months ago

ElSaico commented 8 months ago

Use case: the light/dark toggler from Bootstrap's own documentation makes use of classes such as me-2 for spacing and theme-icon-active for query selecting.

PanderMusubi commented 8 months ago

Was thinking about this earlier. Thanks for the request. Working on a PR now.

PanderMusubi commented 8 months ago

@greyli In the example, why do the links at the end of the nav menu use <li>...</li> and the render_nav_item() don't?

    <a class="nav-item nav-link"
       href="[/icon](view-source:http://127.0.0.1:5000/icon)">
        Icon 
    </a>
    <a class="nav-item nav-link"
       href="[/icons](view-source:http://127.0.0.1:5000/icons)">
        Icons 
    </a>
                <li class="nav-item"><a class="nav-link" href="[https://bootstrap-flask.readthedocs.io/](view-source:https://bootstrap-flask.readthedocs.io/)" target="_blank">Documentation</a></li>
                <li class="nav-item"><a class="nav-link" href="[https://getbootstrap.com/docs/5.1/getting-started/introduction/](view-source:https://getbootstrap.com/docs/5.1/getting-started/introduction/)" target="_blank">Bootstrap Documentation</a></li> 

See also https://github.com/helloflask/bootstrap-flask/blob/master/examples/bootstrap5/templates/base.html#L41 and https://getbootstrap.com/docs/5.3/components/scrollspy/#non-visible-elements

Both work, but what is reommended? With out without the <li>?

greyli commented 8 months ago

I'm not sure. Users can control this with _use_li parameter based on their preference, so I don't think we need to change anything.