The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
UI lib/docs (#34448)
Terry Sutton7b3a63b38974
diff --git a/apps/ui-library/components/mdx-components.tsx b/apps/ui-library/components/mdx-components.tsxindex fdd78766262..5d7158cc1be 100644--- a/apps/ui-library/components/mdx-components.tsx+++ b/apps/ui-library/components/mdx-components.tsx@@ -167,7 +167,7 @@ const components = {<StyleWrapper styleName={__style__}><preclassName={cn(- 'mb-4 mt-6 max-h-[650px] overflow-x-auto rounded-lg border bg-surface-75/75 py-4',+ 'mb-4 mt-6 max-h-[650px] overflow-x-auto rounded-lg border bg-surface-75/75 py-4 text-foreground-light',className)}{...props}diff --git a/apps/ui-library/content/docs/ai-editors-rules/prompts.mdx b/apps/ui-library/content/docs/ai-editors-rules/prompts.mdxindex 1e18b7cf19d..a6693aeaf21 100644--- a/apps/ui-library/content/docs/ai-editors-rules/prompts.mdx+++ b/apps/ui-library/content/docs/ai-editors-rules/prompts.mdx@@ -10,3 +10,9 @@ description: Rules for AI Code Editors for Supabase## Folder structure<RegistryBlock itemName="ai-editor-rules" />++## Usage++Running the install command above will add the rule to the `.cursor/rules` directory in your project. If you don't have a `.cursor/rules` directory, it will be created for you.++Rules are project-specific, so you can have different rules for different projects depending on your needs. Rules are automatically included when matching files are referenced.diff --git a/apps/ui-library/content/docs/nextjs/client.mdx b/apps/ui-library/content/docs/nextjs/client.mdxindex 0d5b914818f..08a7c5ca938 100644--- a/apps/ui-library/content/docs/nextjs/client.mdx+++ b/apps/ui-library/content/docs/nextjs/client.mdx@@ -13,20 +13,25 @@ description: Supabase client for Next.js## Usage-This block installs a Supabase client to be used by Next.js. It's meant to be used with app router and it's fully SSR compatible.+This block installs a Supabase client for connecting your Next.js project to Supabase. It's designed for use with the App Router and fully supports server-side rendering (SSR).-If you already have your Supabase client(s) set up and working well (through the through `npx create-next-app -e with-supabase` template or in another way) you can just continue using them.+If you've already set up your Supabase client—either using the `npx create-next-app -e with-supabase` template or another method—you can continue using your existing setup.-To get started, you need to add an `.env` file to your project with the following entries:+### Getting started++First, add a `.env` file to your project with the following environment variables:```envNEXT_PUBLIC_SUPABASE_URL=NEXT_PUBLIC_SUPABASE_ANON_KEY=```-If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if already running).+- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).-If you're using supabase.com project, you can find them in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).+- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).-This block provides Supabase clients designed for use with SSR by storing JWT tokens in cookies. If you're-developing a React SPA, use the [React SPA client](/ui/docs/react-router/client) instead.+<Callout type="warning" className="mt-4">+ {' '}+ This Supabase client is built for SSR with the Next.js App Router. If you're building a React SPA,+ use the [React SPA client](/ui/docs/react-router/client) instead.{' '}+</Callout>diff --git a/apps/ui-library/content/docs/nextjs/dropzone.mdx b/apps/ui-library/content/docs/nextjs/dropzone.mdxindex 44e009a2f5f..947ca43539b 100644--- a/apps/ui-library/content/docs/nextjs/dropzone.mdx+++ b/apps/ui-library/content/docs/nextjs/dropzone.mdx@@ -21,20 +21,31 @@ description: Displays a control for easier uploading of files directly to Supaba## Introduction-The File Upload component is designed to allow users to upload files with specific features and restrictions. It supports drag-and-drop functionality, MIME type restrictions, image previews, and configurable limits on file size and number of files.+Uploading files should be easy—this component handles the tricky parts for you.-## Features--1. **Drag-and-Drop**. Support drag-and-drop functionality for adding files.+The File Upload component makes it easy to add file uploads to your app, with built-in support for drag-and-drop, file type restrictions, image previews, and configurable limits on file size and number of files. All the essentials, ready to go.-1. **Multiple Files**. Allow users to upload multiple files at once.+## Features-1. **MIME Type Restriction**. Only allow specific MIME types.+- Drag-and-drop support+- Multiple file uploads+- File size and count limits+- Image previews for supported file types+- MIME type restrictions+- Invalid file handling+- Success and error states with clear feedback-1. **Invalid File Handling**. Allow users to remove invalid files from the list. Display a tooltip with error information for invalid files.+## Usage-1. **Image Previews**. Display previews for image files.+- Simply add this `<Dropzone />` component to your page and it will handle the rest.+- For control over file upload, you can pass in a `props` object to the component.-1. **Success and Error Handling**. Show error messages if the upload fails due to network or server errors, show a success message and clear the file list upon successful upload.+## Props-1. **Configurable Limits**. Allow configuration of file size limits and the maximum number of files.+| Prop | Type | Default | Description |+| ------------------ | ---------- | ------- | ---------------------------------------------------- |+| `bucketName` | `string` | `null` | The name of the Supabase Storage bucket to upload to |+| `path` | `string` | `null` | The path or subfolder to upload the file to |+| `allowedMimeTypes` | `string[]` | `[]` | The MIME types to allow for upload |+| `maxFiles` | `number` | `1` | Maximum number of files to upload |+| `maxFileSize` | `number` | `1000` | Maximum file size in bytes |diff --git a/apps/ui-library/content/docs/nextjs/password-based-auth.mdx b/apps/ui-library/content/docs/nextjs/password-based-auth.mdxindex 9957ee2f86d..0ea4b7b919c 100644--- a/apps/ui-library/content/docs/nextjs/password-based-auth.mdx+++ b/apps/ui-library/content/docs/nextjs/password-based-auth.mdx@@ -12,8 +12,6 @@ description: Password-based Auth block for Next.js appdescription="All needed components for the password based auth flow"/>-This block includes the [Supabase client](/ui/docs/nextjs/client). When installing, you can skip overwriting it.-## Folder structureThis block includes the [Supabase client](/ui/docs/nextjs/client). When installing, you can skip overwriting it.@@ -22,11 +20,23 @@ This block includes the [Supabase client](/ui/docs/nextjs/client). When installi## Usage-After installing the block in your Next.js project, you'll have all needed pages and components to build a password-based authentication flow.+Once you install the block in your Next.js project, you'll get all the necessary pages and components to set up a password-based authentication flow.++### Getting started++First, add a `.env` file to your project with the following environment variables:++```env+NEXT_PUBLIC_SUPABASE_URL=+NEXT_PUBLIC_SUPABASE_ANON_KEY=+```-To finish the installation:+- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).++- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).++### Adding email templates-1. Set the `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY` environment variables in your `.env` file in your project. Find them in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks.1. Add an [email template for sign-up](https://supabase.com/dashboard/project/_/auth/templates) to the Supabase project. Your signup email template should contain at least the following HTML:```html@@ -41,10 +51,31 @@ To finish the installation:</p>```- For detailed instructions on how to configure your email templates, including the use of variables like `{{ .SiteURL }}`,`{{ .TokenHash }}`, and `{{ .RedirectTo }}`, refer to our [Email Templates guide](/docs/email-templates).+ For detailed instructions on how to configure your email templates, including the use of variables like `{{ .SiteURL }}`,`{{ .TokenHash }}`, and `{{ .RedirectTo }}`, refer to our [Email Templates guide](https://supabase.com/docs/email-templates).++1. Add an [email template for reset password](https://supabase.com/dashboard/project/_/auth/templates) to the Supabase project. Your reset password email template should contain at least the following HTML:++ ```html+ <h2>Reset Password</h2>++ <p>Follow this link to reset the password for your user:</p>+ <p>+ <a+ href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=recovery&next={{ .RedirectTo }}"+ >Reset Password</a+ >+ </p>+ ```++### Setting up routes and redirect URLs++1. Set the site URL in the [URL Configuration](https://supabase.com/dashboard/project/_/auth/url-configuration) settings in the Supabase Dashboard.+1. Set up the Next.js route users will visit to reset or update their password. First, update the `forgot-password-form.tsx` component with your `forgot-password` route. You'll need to tell Supabase to allow this route as the redirect URL. Go to the [URL Configuration](https://supabase.com/dashboard/project/_/auth/url-configuration) settings and add that route to the list of Redirect URLs. It should look something like: `http://example.com/auth/forgot-password`.-1. Set the site URL in the [Supabase Dashboard](https://supabase.com/dashboard/project/_/auth/url-configuration).-1. Set the `forgot-password` route in `forgot-password-form.tsx` component. The same route also needs to be configured as a redirect URL in the [Supabase Dashboard](https://supabase.com/dashboard/project/_/auth/url-configuration). It should look something like this: `http://example.com/auth/forgot-password`.1. Update the redirect paths in the `login-form.tsx` and `update-password-form.tsx` components to point to the logged-in routes in your app.-You can use this block with pages router by simply moving the routes from the `app` folder into the `pages` folder and renaming them.+<Callout type="info">++You can use this block with the Pages router by simply moving the routes from the `app` folder into the `pages` folder and renaming them. Example instead of `app/sign-up/page.tsx`, you'd create a `pages/sign-up.tsx` file.++</Callout>diff --git a/apps/ui-library/content/docs/nextjs/realtime-cursor.mdx b/apps/ui-library/content/docs/nextjs/realtime-cursor.mdxindex 478a504e5e8..c8bd2557881 100644--- a/apps/ui-library/content/docs/nextjs/realtime-cursor.mdx+++ b/apps/ui-library/content/docs/nextjs/realtime-cursor.mdx@@ -23,8 +23,23 @@ description: Real-time cursor sharing for collaborative applications## Introduction-The Realtime Cursor component is designed to allow users to share their cursor positions with other users in a room. It can be used to build real-time collaborative applications.+The Realtime Cursors component lets users share their cursor position with others in the same room—perfect for real-time collaboration. It handles all the setup and boilerplate for you, so you can add it to your app with minimal effort.## UsageThe Realtime Cursor component is designed to be used in a room. It can be used to build real-time collaborative applications. Add the `<RealtimeCursors />` component to your page and it will render realtime cursors from other users in the room.++## Features++- Broadcast cursor position to other users in the same room+- Customizable cursor appearance+- Presence detection (automatically joins/leaves users)+- Low-latency updates using Supabase Realtime+- Room-based isolation for scoped collaboration++## Props++| Prop | Type | Description |+| ---------- | -------- | ---------------------------------------------------------- |+| `roomName` | `string` | Unique identifier for the shared room or session. |+| `username` | `string` | Name of the current user; used to track and label cursors. |