tab
django_spire.core.components.tab
__all__ = ['Tab', 'TabsComponent']
module-attribute
Tab
dataclass
Declares one tab inside a :class:TabsComponent.
Provide exactly one target:
- component: a Glue.Component class or zero-argument factory callable
(e.g. partial(EmployeeListComponent, is_active=True))
- view_url: a Django route URL loaded lazily via Glue.view(url)
- template: a Django template rendered into the pane (with optional context)
- href: a full-page link rendered as an <a> tag instead of swapping panes
id
instance-attribute
label
instance-attribute
component = None
class-attribute
instance-attribute
view_url = None
class-attribute
instance-attribute
template = None
class-attribute
instance-attribute
context = field(default_factory=dict)
class-attribute
instance-attribute
href = None
class-attribute
instance-attribute
icon = None
class-attribute
instance-attribute
cache = None
class-attribute
instance-attribute
view_method = 'GET'
class-attribute
instance-attribute
kind
property
is_component
property
is_view
property
is_template
property
is_link
property
__post_init__
Source code in django_spire/core/components/tab/options.py
build_component
Source code in django_spire/core/components/tab/options.py
TabsComponent
Bases: Component, ABC
A tabbed container whose panes are loaded lazily and may host Glue
components, Django fragment views (via Glue.view), plain templates, or
full-page links.
Subclasses implement get_tabs() returning a sequence of :class:Tab
items (aliased as self.Tab). Only the initially active tab is rendered
on first paint; other tabs stay empty until selected.
url_param: query parameter synced withhistory.replaceStateand read fromrequest.GETon first render (default'tab'; set toNoneto disable).cache_tabs: whether visited panes stay mounted across switches (defaultTrue; overridable per tab viaTab(..., cache=False)).tab_invalidated: Glue event wired toinvalidateTab(tab_id)so listeners can mark a cached tab stale or force-refresh the active tab.