Amount
2 years ago
Consent
2 years ago
Checkbox.tsx
2 years ago
Date.tsx
2 years ago
Email.tsx
2 years ago
File.tsx
2 years ago
Gateways.tsx
2 years ago
Hidden.tsx
2 years ago
MultiSelect.tsx
2 years ago
Password.tsx
2 years ago
Phone.tsx
2 years ago
Radio.tsx
2 years ago
Select.tsx
2 years ago
Text.tsx
2 years ago
TextArea.tsx
2 years ago
Url.tsx
2 years ago
Checkbox.tsx
20 lines
| 1 | import type {CheckboxProps} from '@givewp/forms/propTypes'; |
| 2 | |
| 3 | /** |
| 4 | * @since 3.0.0 |
| 5 | */ |
| 6 | export default function Checkbox({Label, ErrorMessage, value, helpText, fieldError, inputProps}: CheckboxProps) { |
| 7 | const FieldDescription = window.givewp.form.templates.layouts.fieldDescription; |
| 8 | |
| 9 | return ( |
| 10 | <> |
| 11 | <label> |
| 12 | <input type="checkbox" value={value} aria-invalid={fieldError ? 'true' : 'false'} {...inputProps} /> |
| 13 | <Label /> |
| 14 | </label> |
| 15 | {helpText && <FieldDescription description={helpText} />} |
| 16 | <ErrorMessage /> |
| 17 | </> |
| 18 | ); |
| 19 | } |
| 20 |