({ label, value, onChange, disabled = false }: SwitchInputProps)
| 12 | * Mirrors the original Flowise SwitchInput component. |
| 13 | */ |
| 14 | export function SwitchInput({ label, value, onChange, disabled = false }: SwitchInputProps) { |
| 15 | const checked = value !== undefined ? !!value : false |
| 16 | |
| 17 | return ( |
| 18 | <FormControl |
| 19 | sx={{ mt: 1, width: '100%', display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }} |
| 20 | size='small' |
| 21 | > |
| 22 | {label && <Typography>{label}</Typography>} |
| 23 | <Switch |
| 24 | disabled={disabled} |
| 25 | checked={checked} |
| 26 | onChange={(event) => { |
| 27 | onChange(event.target.checked) |
| 28 | }} |
| 29 | /> |
| 30 | </FormControl> |
| 31 | ) |
| 32 | } |
nothing calls this directly
no test coverage detected