import * as React from 'react'; import JqxToggleButton, { IToggleButtonProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxtogglebutton'; class App extends React.PureComponent<{}, IToggleButtonProps> { private myToggleButton = React.createRef(); constructor(props: {}) { super(props); this.click = this.click.bind(this); this.state = { height: 30, toggled: true, value: "Toggled On", width: 200, } } public render() { return (
); } // Event handling private click(event: any): void { const toggled = this.myToggleButton.current!.getOptions("toggled"); if (toggled) { this.setState({ toggled: true, value: "Toggled On", }); } else { this.setState({ toggled: false, value: "Toggled Off", }); } } } export default App;