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

Documentation

Version switch

A documentation-version navigation switcher.

All components Component Brickwork 4.3.1

Try it

Versioned docs

Open full-page preview

Current stable release.

Use in a docs header when routes for equivalent pages across versions are known.

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_version_switch versions=versions current=current placement=placement %}

your_app/views.py

Python

context = {'versions': [{'label': '4.2', 'href': '/docs/4.2/components/', 'status': 'latest'}, {'label': '4.1', 'href': '/docs/4.1/components/', 'status': 'deprecated'}], 'current': '4.2', 'placement': 'end'}

Guide

Add it to your project

  1. Load `brickwork_components`.
  2. Call `bw_version_switch` with versions and the label of exactly one current version.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
versions list of mappings Not set Yes Each requires label and href; optional status. Allowed: latest, deprecated. Constraint: Each version record needs an identifier, label, and valid destination; `current` must match one identifier.
current string Not set Yes Must match exactly one version label. Constraint: Must match an identifier declared by the corresponding structured collection.
label string Documentation version No Navigation landmark name. Constraint: Use concise visible text that identifies the control or measurement.
placement string start No Panel edge. Allowed: start, end. Constraint: Use only one of the documented logical or physical placement choices.

Behaviour

Accessibility and responsive behaviour

Accessibility
Native nav labels current version with `aria-current`; statuses are text, not colour-only.
Responsive
Fluid inside docs header.
Without JavaScript
Native details/summary and ordinary links require no JavaScript.

Need help?

Troubleshooting

Contract check: tag enforces a non-empty versions list, a current= that matches exactly one

Use the version-switch tag with a non-empty versions list and a `current` value matching exactly one version.

Explore next

Used in examples

Documentation