Account menu
A native disclosure for account and session actions in the shell top bar.
Try it
Account actions
A profile link and POST sign-out.
Use it
Working invocation
This code creates the configuration shown above. Copy the template and the required Python context together.
{% include "brickwork/components/_account_menu.html" with items=account_items trigger_label=trigger_label %}
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
- Create the item dictionaries in the view or context processor.
- Include `brickwork/components/_account_menu.html` in `topbar_account_menu`.
- Use `method="post"` for Django POST-only logout endpoints.
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.