Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/textual/widgets/_collapsible.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

from rich.console import RenderableType

from textual import events
from textual.app import ComposeResult
from textual.binding import Binding
Expand Down Expand Up @@ -49,7 +51,7 @@ class CollapsibleTitle(Static, can_focus=True):
def __init__(
self,
*,
label: str,
label: RenderableType,
collapsed_symbol: str,
expanded_symbol: str,
collapsed: bool,
Expand All @@ -74,7 +76,7 @@ def action_toggle_collapsible(self) -> None:
"""Toggle the state of the parent collapsible."""
self.post_message(self.Toggle())

def _watch_label(self, label: str) -> None:
def _watch_label(self, label: RenderableType) -> None:
self._collapsed_label = f"{self.collapsed_symbol} {label}"
self._expanded_label = f"{self.expanded_symbol} {label}"
if self.collapsed:
Expand Down Expand Up @@ -158,7 +160,7 @@ class Contents(Container):
def __init__(
self,
*children: Widget,
title: str = "Toggle",
title: RenderableType = "Toggle",
collapsed: bool = True,
collapsed_symbol: str = "▶",
expanded_symbol: str = "▼",
Expand Down Expand Up @@ -227,5 +229,5 @@ def compose_add_child(self, widget: Widget) -> None:
"""
self._contents_list.append(widget)

def _watch_title(self, title: str) -> None:
def _watch_title(self, title: RenderableType) -> None:
self._title.label = title