diff --git a/haxe/ui/core/Component.hx b/haxe/ui/core/Component.hx index 2ebf97704..e43a80e4a 100644 --- a/haxe/ui/core/Component.hx +++ b/haxe/ui/core/Component.hx @@ -1420,6 +1420,14 @@ class Component extends ComponentImpl } } + public function toggleClass(name:String, invalidate:Bool = true, recursive:Bool = false) { + if (classes.indexOf(name) == -1) { + addClass(name, invalidate, recursive); + } else { + removeClass(name, invalidate, recursive); + } + } + /** * A string representation of the `css` classes associated with this component */