2022-05-18 21:54:29 +03:00

23 lines
554 B
TypeScript

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