rohan13's picture
Flowise Changes
4114d85
raw
history blame contribute delete
811 Bytes
import { useState } from 'react'
import PropTypes from 'prop-types'
import { FormControl, Switch } from '@mui/material'
export const SwitchInput = ({ value, onChange, disabled = false }) => {
const [myValue, setMyValue] = useState(!!value ?? false)
return (
<>
<FormControl sx={{ mt: 1, width: '100%' }} size='small'>
<Switch
disabled={disabled}
checked={myValue}
onChange={(event) => {
setMyValue(event.target.checked)
onChange(event.target.checked)
}}
/>
</FormControl>
</>
)
}
SwitchInput.propTypes = {
value: PropTypes.string,
onChange: PropTypes.func,
disabled: PropTypes.bool
}