Skip to content

Commit 572d9b6

Browse files
authored
Merge pull request #1195 from davep/button-variant-check
Check button variant for validity during button construction
2 parents e32e094 + e3899c0 commit 572d9b6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3131

3232
- Watchers are now called immediately when setting the attribute if they are synchronous. https://github.com/Textualize/textual/pull/1145
3333
- Widget.call_later has been renamed to Widget.call_after_refresh.
34+
- Button variant values are now checked at runtime. https://github.com/Textualize/textual/issues/1189
3435

3536
### Fixed
3637

src/textual/widgets/_button.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def __init__(
186186
if disabled:
187187
self.add_class("-disabled")
188188

189-
self.variant = variant
189+
self.variant = self.validate_variant(variant)
190190

191191
label: Reactive[RenderableType] = Reactive("")
192192
variant = Reactive.init("default")

0 commit comments

Comments
 (0)