Breadcrumbs¶
Breadcrumbs provide navigation helpers showing the heirarchy for the current page. Bootstrap provides a default style for breadcrumbs: https://getbootstrap.com/docs/5.3/components/breadcrumb/
|
The trail of breadcrumbs |
|
A single breadcrumb, representing a single, possibly active, endpoint |
|
An extension for breadcrumbs |
- class bootlace.breadcrumbs.Breadcrumbs(crumbs: list[~bootlace.breadcrumbs.Breadcrumb] = NOTHING, divider: str = '>', nav: ~bootlace.util.Tag = Tag(tag=<class 'dominate.tags.nav'>, classes=set(), attributes={}), ol: ~bootlace.util.Tag = Tag(tag=<class 'dominate.tags.ol'>, classes={'breadcrumb'}, attributes={}), li: ~bootlace.util.Tag = Tag(tag=<class 'dominate.tags.li'>, classes={'breadcrumb-item'}, attributes={}))[source]¶
The trail of breadcrumbs
Supports the
as_tag()protocol to render the breadcrumbs as HTML- crumbs: list[Breadcrumb]¶
The list of breadcrumbs, in order from broadest to most specific
- divider: str¶
The divider to use between breadcrumbs
- push(crumb: Breadcrumb) → None[source]¶
Add a new crumb to the beginning of the list
- class bootlace.breadcrumbs.Breadcrumb(title: str, link: ~bootlace.endpoint.Endpoint, a: ~bootlace.util.Tag = Tag(tag=<class 'dominate.tags.a'>, classes=set(), attributes={}))[source]¶
A single breadcrumb, representing a single, possibly active, endpoint
- property active: bool¶
Whether the breadcrumb is the active view
- title: str¶
The title of the breadcrumb, displayed in text
- property url: str¶
The URL for the breadcrumb
- class bootlace.breadcrumbs.BreadcrumbExtension(app: Flask | None = None)[source]¶
An extension for breadcrumbs
- property divider: str¶
The divider to use between breadcrumbs
- get() → Breadcrumbs[source]¶
Get the
Breadcrumbsfor the current request
- register(context: Flask | Blueprint | None, parent: str | Endpoint | None, title: str) → Callable[[V], V][source]¶
Register a breadcrumb for a view
- Parameters:
context – The context for the view, if any. For a blueprint, this is the blueprint object. For a view on the root app, this ie either the root app or None.
parent – The parent for the breadcrumb. This can be a string, an endpoint, or None. If a string, it is the name of the parent endpoint. If an endpoint, it is the parent endpoint. If None, there is no parent, and this is a root item.
title – The title of the breadcrumb
- Returns:
A decorator that can be used to register the view, which will return the view unchanged.
Additional Data Objects¶
- class bootlace.breadcrumbs.Endpoint(*, context: None | Blueprint = None, name: str, url_kwargs: Any = NOTHING, ignore_query: bool = True)[source]¶
An endpoint for a breadcrumb, as captured at registration
- property active: bool¶
Whether the endpoint is active
- property blueprint: str | None¶
The blueprint for the endpoint
- context: None | Blueprint¶
The flask context, if any
- classmethod from_name(name: str, **kwargs: Any) → Endpoint[source]¶
Create an endpoint from a name and keyword arguments
- property full_name: str¶
The full name of the endpoint
- ignore_query: bool¶
Whether to ignore the query string when checking for active status
- name: str¶
The endpoint name
- property url: str¶
The URL for the endpoint
- url_kwargs: KeywordArguments¶
The keyword arguments for the endpoint used with url_for