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

Documentation

Account menu

A native disclosure for account and session actions in the shell top bar.

All components Component Brickwork 4.3.1

Try it

Account actions

Open full-page preview

A profile link and POST sign-out.

Use in the shell `topbar_account_menu` block when users need profile, settings, or sign-out links.

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/_account_menu.html" with items=account_items trigger_label=trigger_label %}

your_app/views.py

Python

context = {'account_items': [{'label': 'Profile', 'url': '/profile/', 'icon': 'user'}, {'label': 'Sign out', 'url': '/logout/', 'icon': 'log-out', 'danger': True, 'method': 'post'}], 'trigger_label': 'Account'}

Guide

Add it to your project

  1. Create the item dictionaries in the view or context processor.
  2. Include `brickwork/components/_account_menu.html` in `topbar_account_menu`.
  3. Use `method="post"` for Django POST-only logout endpoints.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
items list[dict] Not set Yes Items with `label`, `url`, optional `icon`, `danger`, and `method`. Constraint: Each item needs label and url; method is `get` or `post`.
trigger_label str Account No Visible and accessible name for the summary and nav landmark. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
trigger_icon str user No Registered icon for the trigger. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
placement str end No Panel edge anchoring. Allowed: end, start. Constraint: Use only one of the documented logical or physical placement choices.
menu_open bool False No Initial native-details state. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.

Behaviour

Accessibility and responsive behaviour

Accessibility
Uses native `details` and a labelled nav of ordinary links or buttons, deliberately avoiding menu roles that need arrow-key scripting.
Responsive
No breakpoint-specific layout.
Without JavaScript
Opening and POST submission work with normal browser behaviour; no JavaScript is required.

Need help?

Troubleshooting

Contract check: a GET <a href> against it 405s. Absent, or explicitly "get", renders

A POST-only account action such as sign out needs `method="post"`; the component then renders its CSRF-safe form/button path.

Documentation