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

Documentation

Theme switch

A client-side root theme, density, direction and optional brand axis control.

All components Component Brickwork 4.3.1

Try it

Compact header control

Open full-page preview

Theme and density switch in a header.

Display settings
Theme
Density
Use where users may change display axes and the theme context processor is installed.

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_theming %}
{% bw_theme_switch axes="theme density" layout=layout placement=placement id="display-settings" %}

your_app/views.py

Python

context = {'layout': 'compact', 'placement': 'end'}

Guide

Add it to your project

  1. Load `brickwork_theming` and include the theme context processor.
  2. Call `bw_theme_switch`; choose compact layout for header actions.
  3. Supply `brands` whenever `axes` includes brand.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
axes space-separated string theme density dir No Enabled axes. Allowed: theme, density, dir, brand. Constraint: Use supported shell axes only; host policy may lock axes through `locked_axes`.
brands mapping Not set No Required for brand axis; slug to display label. Constraint: Brand records must be supplied by the host's validated theme resolver.
label string Display settings No Control accessible name. Constraint: Use concise visible text that identifies the control or measurement.
locked_axes space-separated string Not set No Read-only axes; omitted reads theme context. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
layout string inline No Presentation. Allowed: inline, compact. Constraint: Allowed values: `inline`, `compact`.
placement string end No Compact panel edge. Allowed: start, end. Constraint: Only valid with compact layout.
data mapping Not set No Consumer data-* attributes. Constraint: Use the component's documented structured data shape; it is not a scalar visitor control.
id string Not set No Stable id-safe instance token. Constraint: Use a stable id-safe token of letters, digits, hyphens, or underscores; it must be unique on the page.

Behaviour

Accessibility and responsive behaviour

Accessibility
Each axis is a fieldset/legend; locked values are disabled. Compact uses native details/summary.
Responsive
Compact panel is anchored logically; pre-init reserves its layout box.
Without JavaScript
By design it remains invisible without JS because an apparently working control would be misleading.

Need help?

Troubleshooting

Contract check: (templatetags/brickwork_theming.py): never {% include %} directly, the tag

Use the theme-switch tag so it validates axes, resolves option groups, and applies host lock state.

Documentation