Button
Description
A configurable button with size and variant modifiers.
Demonstrates:
StrParamwith positional argsStrParam(css_class=True)— value injected as a CSS modifier classBoolParam(css_class=True)— adds a CSS class when truthy- Co-located CSS file (
button.css) discovered automatically - Co-located HTML template (
button.html) discovered automatically
Example usage:
{% button "Save changes" %}
{% button "Delete" variant="danger" disabled=True %}
Usage
Primary Button
{% button "Click Me" variant="primary" %}
All parameters
{% button
"foo"
variant="primary"
disabled=True
%}
Qualified tag usage
{% btn__button "Click Me" variant="primary" %}
Parameters
| Name | Type | Requirement | Default | Choices | Description |
|---|---|---|---|---|---|
label
|
str
|
Required | — | — | The button label. |
variant
|
str
|
Optional |
primary
|
primary
secondary
danger
|
Variant modifier |
disabled
|
bool
|
Optional | — | — | Renders the button as disabled. |
Select variant preset
Background colour
Viewport width
Zoom level
{% button "Click Me" variant="primary" %}
<button class="btn primary disabled" disabled>
foo
</button>