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

Documentation

Alert

A page-level status banner announced when it enters the page.

All components Component Brickwork 4.3.1

Try it

Danger with title

Open full-page preview

A concise failure message.

Use for success, warning, information, or failure that concerns the current page, rather than field-level validation 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_alert message=message variant=variant title=title %}

your_app/views.py

Python

context = {'variant': 'danger', 'title': 'Save failed', 'message': 'We could not save your changes.'}

Guide

Add it to your project

  1. Load `brickwork_components`.
  2. Call `{% bw_alert %}` for the validated public API.
  3. Extend the partial only when the `body` block needs rich markup.

View this component's source for the installed release

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

Used in examples

Documentation