Button¶
See: https://material.io/components/buttons
Buttons allow users to take actions, and make choices, with a single tap.
Provides template tag:
Button
.Example usage:
{% load materialweb %} {% Button mode="raised" type="submit" %} {% Button_Label %} {% trans "Submit" %} {% endButton_Label %} {% endButton %} {% url 'login' as url %} {% Button mode="outlined" tag="a" href=url %} {% Button_Label %} {% trans "Log In" %} {% endButton_Label %} {% endButton %}
Example output:
<div class="mdc-touch-target-wrapper"> <button type="submit" class="mdc-button mdc-button--raised"> <span class="mdc-button__ripple"></span> <span class="mdc-button__label">Submit</span> </button> </div> <div class="mdc-touch-target-wrapper"> <a href="/login" class="mdc-button mdc-button--outlined"> <span class="mdc-button__ripple"></span> <span class="mdc-button__label">Log In</span> </a> </div>
Template Tag needs closing end tag.
Available variants.
Rendered HTML tag.
Provides template tag:
Banner_Label
.Example usage:
{% load materialweb %} {% Button_Label id="mylabel" %} {% trans "My Accessible Button" %} {% endButton_Label %}
Example output:
<span id="mylabel" class="mdc-button__label">My Accessible Button</span>
Template Tag needs closing end tag.
Rendered HTML tag.
Provides template tag:
Button_Icon
.Example usage:
{% load materialweb %} {% Button_Icon %} <i class="fa fa-circle"></i> {% endButton_Icon %}
Example output:
<span aria-hidden="true" class="mdc-button__icon"> <i class="fa fa-circle"></i> </span>
Template Tag needs closing end tag.
Rendered HTML tag.
Provides template tag:
IconButton
.See: https://material.io/develop/web/components/buttons/icon-buttons
Example usage:
{% load materialweb %} {% trans "Save" as label %} {% IconButton label=label type="button" class="material-icons" %} save {% endIconButton %}
<button aria-label="Save" title="Save" type="button" class="mdc-icon-button material-icons"> save </button>
Template Tag needs closing end tag.
Rendered HTML tag.
Provides template tag:
ToggleButton
.See: https://material.io/develop/web/components/buttons/icon-buttons
Example usage:
{% load materialweb %} {% trans "Add to favorites" as label %} {% ToggleButton state=False icon_when_on="favorite" icon_when_off="favorite_border" label=label id="add-to-favorites" %}
Example output:
<button id="add-to-favorites" class="mdc-icon-button" aria-label="Add to favorites" aria-pressed="false"> <i class="material-icons mdc-icon-button__icon mdc-icon-button__icon--on"> favorite </i> <i class="material-icons mdc-icon-button__icon"> favorite_border </i> </button>
Extended Template Tag arguments.