@opalkelly/frontpanel-react-components
Version:
React Component Library for OpalKelly FrontPanel application development
45 lines (36 loc) • 1.08 kB
text/typescript
/**
* Copyright (c) 2024 Opal Kelly Incorporated
*
* This source code is licensed under the FrontPanel license.
* See the LICENSE file found in the root directory of this project.
*/
import { ToggleState } from "../../core";
export type ToggleSize = 1 | 2 | 3;
export type ToggleStateChangeEventHandler = (state: ToggleState) => void;
/**
* Interface for the properties of the `Toggle` component.
*/
interface ToggleProps extends React.PropsWithChildren<NonNullable<unknown>> {
/**
* Current state of the toggle, defined in ToggleState
*/
state: ToggleState;
/**
* Optional CSS class to apply to the toggle
*/
className?: string;
/**
* Optional size of the toggle
* @default 1
*/
size?: ToggleSize;
/**
* Optional tooltip text to be displayed on hover
*/
tooltip?: string;
/**
* Optional event handler for the toggle state change event
*/
onToggleStateChanged?: ToggleStateChangeEventHandler;
}
export default ToggleProps;