22 lines
525 B
TypeScript
22 lines
525 B
TypeScript
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 } from 'antd';
|