Skip to content

Commit 6180961

Browse files
authored
feat: passthrough-props for react-google-recaptcha
Resolves #9
1 parent 0dcc9dc commit 6180961

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/recaptcha.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ import React from 'react'
22
import { useNetlifyFormContext } from './netlify-form-context'
33
import GoogleRecaptcha from 'react-google-recaptcha'
44

5-
export const Recaptcha = ({ siteKey = '', invisible = false }) => {
5+
export const Recaptcha = ({ siteKey = '', invisible = false, ...passThroughProps }) => {
66
const { recaptchaRef } = useNetlifyFormContext()
77

8-
return invisible ? (
9-
<GoogleRecaptcha sitekey={siteKey} ref={recaptchaRef} size='invisible' />
10-
) : (
11-
<GoogleRecaptcha sitekey={siteKey} ref={recaptchaRef} />
8+
return (
9+
<GoogleRecaptcha
10+
{...passThroughProps}
11+
sitekey={siteKey}
12+
ref={recaptchaRef}
13+
{...(invisible ? {size: 'invisible'} : {})}
14+
/>
1215
)
1316
}

0 commit comments

Comments
 (0)