From e25c6290ba4bc694cfaa4e260c9850df68f9fd40 Mon Sep 17 00:00:00 2001 From: darrenburns Date: Wed, 17 May 2023 16:21:32 +0100 Subject: [PATCH] Add classes to Tab widget (#2589) * Add classes to Tab widget * Update CHANGELOG --- CHANGELOG.md | 3 ++- src/textual/widgets/_tabs.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c2cd5a3..80b9b9d67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## Unrealeased +## Unreleased ### Changed @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `Screen.AUTO_FOCUS` now works on the default screen on startup https://github.com/Textualize/textual/pull/2581 - Fix for setting dark in App `__init__` https://github.com/Textualize/textual/issues/2583 - Fix issue with scrolling and docks https://github.com/Textualize/textual/issues/2525 +- Fix not being able to use CSS classes with `Tab` https://github.com/Textualize/textual/pull/2589 ### Added diff --git a/src/textual/widgets/_tabs.py b/src/textual/widgets/_tabs.py index ffeb3fe5b..78c7a6869 100644 --- a/src/textual/widgets/_tabs.py +++ b/src/textual/widgets/_tabs.py @@ -117,15 +117,17 @@ class Tab(Static): label: TextType, *, id: str | None = None, + classes: str | None = None, ) -> None: """Initialise a Tab. Args: label: The label to use in the tab. id: Optional ID for the widget. + classes: Space separated list of class names. """ self.label = Text.from_markup(label) if isinstance(label, str) else label - super().__init__(id=id) + super().__init__(id=id, classes=classes) self.update(label) @property