Module

pages.shell_actions

Route-scoped shell action models and merge helpers.

Nested filesystem routes can contribute actions for persistent shell regions such as the global top bar. Child routes inherit parent contributions by default, may override actions by stableid, remove inherited actions, or replace an entire zone.

Stable DOM id for the actions slot: importSHELL_ACTIONS_TARGETfrom chirp.shell_actions or chirp.shell_regions(same constant). See the UI layers guide insite/content/docs/guides/ui-layers.md.

Classes

ShellMenuItem 7
A menu item rendered inside a shell action dropdown.

A menu item rendered inside a shell action dropdown.

Attributes

Name Type Description
label str
href str | None
action str | None
variant ShellActionVariant
icon str | None
divider bool

Methods

get 2 object
Mapping-like accessor so templates can use dict-style lookups.
def get(self, key: str, default: object = None) -> object
Parameters
Name Type Description
key
default Default:None
Returns
object
ShellAction 21
A single action contribution for a shell region.

A single action contribution for a shell region.

Attributes

Name Type Description
id str
label str
kind ShellActionKind
href str | None
action str | None
variant ShellActionVariant
icon str | None
size str
disabled bool
menu_items tuple[ShellMenuItem, ...]
form_action str | None
form_method str
hidden_fields tuple[tuple[str, str], ...]
include_csrf bool
hx_post str | None
hx_target str | None
hx_swap str | None
hx_disinherit str | None
submit_surface ShellSubmitSurface
attrs str

Methods

as_menu_item 0 ShellMenuItem
Convert a button/link action to a dropdown-compatible menu item.
def as_menu_item(self) -> ShellMenuItem
Returns
ShellMenuItem
ShellActionZone 5
A zone contribution with explicit merge semantics.

A zone contribution with explicit merge semantics.

Attributes

Name Type Description
items tuple[ShellAction, ...]
remove tuple[str, ...]
mode ShellActionZoneMode

Methods

overflow_items 0 tuple[ShellMenuItem, ...]
Dropdown-compatible items for overflow rendering.
property
def overflow_items(self) -> tuple[ShellMenuItem, ...]
Returns
tuple[ShellMenuItem, ...]
Internal Methods 1
__bool__ 0 bool
def __bool__(self) -> bool
Returns
bool
ShellActions 7
Resolved shell actions for persistent chrome regions.

Resolved shell actions for persistent chrome regions.

Attributes

Name Type Description
primary ShellActionZone
controls ShellActionZone
overflow ShellActionZone
target str

Methods

has_items 0 bool
Whether any zone currently contains rendered actions.
property
def has_items(self) -> bool
Returns
bool
Internal Methods 2
__post_init__ 0
def __post_init__(self) -> None
__bool__ 0 bool
def __bool__(self) -> bool
Returns
bool

Functions

merge_shell_actions 2 ShellActions | None
Merge route-scoped shell actions from parent to child.
def merge_shell_actions(parent: ShellActions | None, child: ShellActions | None) -> ShellActions | None
Parameters
Name Type Description
parent ShellActions | None
child ShellActions | None
Returns
ShellActions | None
normalize_shell_actions 1 ShellActions | None
Normalize a context value into ``ShellActions``.
def normalize_shell_actions(value: Any) -> ShellActions | None
Parameters
Name Type Description
value Any
Returns
ShellActions | None
shell_actions_fragment 1 tuple[str, str, str] | N…
Return the template, block, and target for shell OOB rendering.
def shell_actions_fragment(actions: ShellActions | None) -> tuple[str, str, str] | None
Parameters
Name Type Description
actions ShellActions | None
Returns
tuple[str, str, str] | None
validate_shell_actions 1 None
Validate zone contents and stable action ids.
def validate_shell_actions(actions: ShellActions) -> None
Parameters
Name Type Description
actions ShellActions