mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add classes to Tab widget (#2589)
* Add classes to Tab widget * Update CHANGELOG
This commit is contained in:
@@ -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/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
## Unrealeased
|
## Unreleased
|
||||||
|
|
||||||
### Changed
|
### 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
|
- `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 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 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
|
### Added
|
||||||
|
|
||||||
|
|||||||
@@ -117,15 +117,17 @@ class Tab(Static):
|
|||||||
label: TextType,
|
label: TextType,
|
||||||
*,
|
*,
|
||||||
id: str | None = None,
|
id: str | None = None,
|
||||||
|
classes: str | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialise a Tab.
|
"""Initialise a Tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
label: The label to use in the tab.
|
label: The label to use in the tab.
|
||||||
id: Optional ID for the widget.
|
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
|
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)
|
self.update(label)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user