2023-03-29 10:07:34 +03:00

24 lines
574 B
TypeScript

import type { BaseElementProps } from './types';
import type { SwitchProps } from 'antd';
import { Form, Switch as AntSwitch } from 'antd';
import type { FC } from 'react';
const { Item: FormItem } = Form;
function Switch({
value,
setValue,
status,
validateStatus,
help,
...props
}: BaseElementProps<boolean>) {
return (
<FormItem hasFeedback help={help} validateStatus={validateStatus}>
<AntSwitch checked={value} disabled={status === 'Disabled'} onChange={setValue} {...props} />
</FormItem>
);
}
export default Switch as FC<SwitchProps>;