Add classes to Tab widget (#2589)

* Add classes to Tab widget

* Update CHANGELOG
This commit is contained in:
darrenburns
2023-05-17 16:21:32 +01:00
committed by GitHub
parent 7ff205bc29
commit e25c6290ba
2 changed files with 5 additions and 2 deletions

View File

@@ -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

View File

@@ -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