Skip to main content
brickwork
GitHub Log in Get started
Display
Theme
Density
Direction
Brand

Documentation

Badge

A compact label for neutral or low-emphasis status metadata.

All components Component Brickwork 4.3.1

Try it

Warning badge

Open full-page preview

A compact review-state label.

Needs review
Use beside records, category labels, and compact state markers. Use an alert for page-level errors.

Use it

Working invocation

This code creates the configuration shown above. Copy the template and the required Python context together.

templates/your_app/component.html

Django template

{% load brickwork_components %}
{% bw_badge label=label variant=variant icon=icon %}

your_app/views.py

Python

context = {'variant': 'warning', 'icon': 'alert-triangle', 'label': 'Needs review'}

Guide

Add it to your project

  1. Load `brickwork_components`.
  2. Call `{% bw_badge %}` with visible label text.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
label str Not set Yes Badge text. Constraint: Use concise visible text that identifies the control or measurement.
variant str neutral No Semantic colour treatment. Allowed: neutral, success, warning, danger, info. Constraint: Use one of the documented variants; use `danger`, not an invented `error` severity.
icon str Empty string No Optional decorative leading icon. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
dismissible bool False No Enables enhanced removal. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.

Behaviour

Accessibility and responsive behaviour

Accessibility
The label conveys status, with icons decorative; the optional dismiss button has a translated name.
Responsive
No breakpoint switch.
Without JavaScript
The badge works as static content. Its removal control is hidden until enhancement initialises.

Need help?

Troubleshooting

Contract check: tag's dismissible=True the root gains x-data="bwDismissible()" (semver-public,

For `dismissible=True`, initialise Brickwork on the host Alpine instance; the built-in close control calls `bwDismissible`, emits `bw:dismiss`, and visual dismissal does not persist state.

Explore next

Used in examples

Documentation