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

Documentation

Chip

A compact filter or applied-state label that can be selected, linked, or removed.

All components Component Brickwork 4.3.1

Try it

Selected linked filter

Open full-page preview

A current category filter.

Use in filter bars and applied-filter stacks, rather than for combobox committed tags.

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

{% include "brickwork/components/_chip.html" with label=label href="?status=open" selected=selected variant=variant %}

your_app/views.py

Python

from django import forms
class _CountryForm(forms.Form):
    country = forms.ChoiceField(choices=(("gb", "United Kingdom"), ("ie", "Ireland"), ("pt", "Portugal")))
__FORM__ = _CountryForm()
context = {'label': 'Open', 'selected': True, 'variant': 'info'}
context['form'] = __FORM__

Guide

Add it to your project

  1. Supply `label`.
  2. Include with `href` for a linked filter, or without it for a button-like chip.
  3. Initialise interactions only if `dismissible` is needed.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
label str Not set Yes Chip text. Constraint: Use concise visible text that identifies the control or measurement.
variant str neutral No Status tint. Allowed: neutral, info, success, warning, danger. Constraint: Use one of the documented variants; use `danger`, not an invented `error` severity.
selected bool False No Selected state. Constraint: Use values that occur in the option records and match `multiple`.
dismissible bool False No Enhanced removal control. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
size str md No Fixed scale. Allowed: sm, md. Constraint: Use one of the documented size choices; unsupported values are not a responsive substitute.
href str Not set No Renders as a link; selected uses aria-current. Constraint: Use a valid navigable URL and do not combine it with submit-only button fields.

Behaviour

Accessibility and responsive behaviour

Accessibility
Selected buttons use `aria-pressed`; selected links use `aria-current`; the text carries meaning beyond colour.
Responsive
No breakpoint switch.
Without JavaScript
Chip content remains usable; the removal control is hidden until JavaScript starts.

Need help?

Troubleshooting

Contract check: uses aria-current="true". Dismiss control is icon-only with a translated

Keep the chip label present when it is dismissible; the package gives its close control the translated accessible name.

Documentation