Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Convert to tabs

Terry Suttoncde0f97c7e6f
diff --git a/apps/docs/pages/guides/auth/auth-captcha.mdx b/apps/docs/pages/guides/auth/auth-captcha.mdx
index d5e62c4d22f..b2546a5c7b6 100644
--- a/apps/docs/pages/guides/auth/auth-captcha.mdx
+++ b/apps/docs/pages/guides/auth/auth-captcha.mdx
@@ -1,5 +1,4 @@
import Layout from '~/layouts/DefaultGuideLayout'
-import { Accordion } from 'ui'
export const meta = {
id: 'auth-captcha',
@@ -21,20 +20,13 @@ Supabase provides you with the option of adding captcha to your sign-in, sign-up
## Sign up for Captcha
-<Accordion
- type="default"
- openBehaviour="multiple"
- chevronAlign="right"
- justified
- size="medium"
- className="text-scale-900 dark:text-white"
- >
- <div className="border-b pb-3">
- <Accordion.Item
- header={<span className="text-scale-1200 font-bold">HCaptcha</span>}
- id={`HCaptcha-Signup`}
- >
-
+<Tabs
+ scrollable
+ size="small"
+ type="underlined"
+ defaultActiveId="hcaptcha-1"
+>
+<TabPanel id="hcaptcha-1" label="HCaptcha">
Go to the [hCaptcha](https://www.hcaptcha.com/) website and sign up for an account. On the welcome page, copy the **Sitekey** and **Secret key**.
If you have already signed up and didn't copy this information from the welcome page, you can get the **Secret key** from the settings page.
@@ -48,20 +40,14 @@ The **Sitekey** can be found in the **Settings** of the active site you created.
In the Settings page, look for the **Sitekey** section and copy the key.
![sitekey_settings.png](/docs/img/guides/auth-captcha/sitekey_settings.png)
- </Accordion.Item>
-
- </div>
- <div className="border-b pb-3">
- <Accordion.Item
- header={<span className="text-scale-1200 font-bold">Turnstile</span>}
- id={`Turnstile-Signup`}
- >
- Go to the [Cloudflare website](https://dash.cloudflare.com/login) and sign up for an account. On the welcome page, head to the Turnstile section and add a new site. Create a site and take note of the **Sitekey** and **Secret Key** as shown below
- ![cloudflare_settings.png](/docs/img/guides/auth-captcha/cloudflare_settings.png)
- </Accordion.Item>
- </div>
- </Accordion>
+</TabPanel>
+
+<TabPanel id="turnstile-1" label="Turnstile">
+ Go to the [Cloudflare website](https://dash.cloudflare.com/login) and sign up for an account. On the welcome page, head to the Turnstile section and add a new site. Create a site and take note of the **Sitekey** and **Secret Key** as shown below
+ ![cloudflare_settings.png](/docs/img/guides/auth-captcha/cloudflare_settings.png)
+</TabPanel>
+</Tabs>
## Enable Captcha protection for your Supabase project
@@ -75,19 +61,14 @@ Enter your Captcha **Secret key** and click **Save**.
The frontend requires some changes to provide the captcha on-screen for the user. This example uses React and the corresponding Captcha React component, but both Captcha providers can be used with any JavaScript framework.
-<Accordion
- type="default"
- openBehaviour="multiple"
- chevronAlign="right"
- justified
- size="medium"
- className="text-scale-900 dark:text-white"
- >
- <div className="border-b pb-3">
- <Accordion.Item
- header={<span className="text-scale-1200 font-bold">HCaptcha</span>}
- id={`HCaptcha-React`}
- >
+<Tabs
+ scrollable
+ size="small"
+ type="underlined"
+ defaultActiveId="hcaptcha-2"
+>
+
+<TabPanel id="hcaptcha-2" label="HCaptcha">
Install `@hcaptcha/react-hcaptcha` in your project as a dependency.
@@ -101,7 +82,7 @@ Now import the `HCaptcha` component from the `@hcaptcha/react-hcaptcha` library.
import HCaptcha from '@hcaptcha/react-hcaptcha'
```
-Let’s create a empty state to store our `captchaToken`
+Let's create a empty state to store our `captchaToken`
```jsx
const [captchaToken, setCaptchaToken] = useState()
@@ -118,7 +99,7 @@ We will pass it the sitekey we copied from the hCaptcha website as a property al
```jsx
<HCaptcha
sitekey="your-sitekey"
-  onVerify={(token) => { setCaptchaToken(token) }
+ onVerify={(token) => { setCaptchaToken(token) }
/>
```
@@ -159,29 +140,26 @@ captcha.current.resetCaptcha()
```
In order to test that this works locally we will need to use something like [ngrok](https://ngrok.com/) or add an entry to your hosts file. You can read more about this in the [hCaptcha docs](https://docs.hcaptcha.com/#local-development).
- </Accordion.Item>
- </div>
-<div className="border-b pb-3">
- <Accordion.Item
- header={<span className="text-scale-1200 font-bold">Turnstile</span>}
- id={`Turnstile-React`}
- >
+
+</TabPanel>
+
+<TabPanel id="turnstile-2" label="Turnstile">
+
The frontend requires some changes to provide the captcha on-screen for the user. This example uses React and the Turnstile React component, but Turnstile can be used with any JavaScript framework.
-Install @marsidev/react-turnstile in your project as a dependency.
+
+Install @marsidev/react-turnstile in your project as a dependency.
```bash
npm install @marsidev/react-turnstile
```
-
-Now import the Turnstile component from the @marsidev/react-turnstile library.
+Now import the Turnstile component from the @marsidev/react-turnstile library.
```jsx
import { Turnstile } from '@marsidev/react-turnstile'
```
-
-Let’s create an empty state to store our `captchaToken`
+Let's create an empty state to store our `captchaToken`
```jsx
const [captchaToken, setCaptchaToken] = useState()
@@ -198,7 +176,7 @@ We will pass it the sitekey we copied from the Cloudflare website as a property
```jsx
<Turnstile
sitekey="your-sitekey"
-  onVerify={(token) => { setCaptchaToken(token) }
+ onVerify={(token) => { setCaptchaToken(token) }
/>
```
@@ -214,9 +192,9 @@ await supabase.auth.signUp({
To test locally, you will need to add localhost to the domain whitelist as per the [Cloudflare docs](https://developers.cloudflare.com/turnstile/reference/testing/)
- </Accordion.Item>
- </div>
- </Accordion>
+ </TabPanel>
+ </Tabs>
+
Run the application and you should now be provided with a captcha challenge.
export const Page = ({ children }) => <Layout meta={meta} children={children} />