Skip to content

Commit

Permalink
toggleClass
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Jul 9, 2024
1 parent c40e6e6 commit d96afd6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions haxe/ui/core/Component.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit d96afd6

Please sign in to comment.