Alert
A page-level status banner announced when it enters the page.
Try it
Danger with title
A concise failure message.
Use it
Working invocation
This code creates the configuration shown above. Copy the template and the required Python context together.
{% load brickwork_components %}
{% bw_alert message=message variant=variant title=title %}
context = {'variant': 'danger', 'title': 'Save failed', 'message': 'We could not save your changes.'}
Guide
Add it to your project
- Load `brickwork_components`.
- Call `{% bw_alert %}` for the validated public API.
- Extend the partial only when the `body` block needs rich markup.
Options
Public API
| Option | Type | Default | Required | Description |
|---|---|---|---|---|
| message | str | Empty string | No | Main alert copy. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component. |
| variant | str | info | No | Semantic status treatment. Allowed: info, success, warning, danger. Constraint: Use one of the documented variants; use `danger`, not an invented `error` severity. |
| title | str | Empty string | No | Short status heading. Constraint: Must be non-empty when it supplies an accessible heading; a named title block may replace it. |
| dismissible | bool | False | No | Enables client-side dismissal when Brickwork interactions are initialised. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component. |
Named blocks
Fill these only when you extend the component template. They are not values passed to an include or tag.
| Block | What it replaces |
|---|---|
| body | Extra rich content below title and message. Constraint: Fill only when extending; `alert_body` was removed. |
Behaviour
Accessibility and responsive behaviour
- Accessibility
- The root has `role="alert"`; the status icon is decorative and dismissal has an accessible name.
- Responsive
- Full width in its container with no breakpoint switch.
- Without JavaScript
- The alert remains visible. A dismiss control is hidden until its JavaScript enhancement is ready.
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 and listen for `bw:dismiss` if the host needs persistence; the built-in close control handles visual dismissal.
Explore next