---
title: React with Neon Auth UI (UI Components)
subtitle: Build authentication with pre-built UI components
enableTableOfContents: true
updatedOn: '2025-12-18T12:00:58.020Z'
layout: wide
---
If you don't have a Neon project yet, create one at [console.neon.tech](https://console.neon.tech).
Go to the **Auth** page in your project dashboard and click **Enable Neon Auth**.
You can then find your Auth URL on the Configuration tab. Copy this URL - you'll need it in the next step.

Create a React app using Vite with TypeScript.
```bash
npm create vite@latest my-app -- --template react-ts
```
Install the Neon SDK, UI components, and React Router:
```bash
cd my-app
npm install @neondatabase/neon-js react-router-dom
```
Create a `.env` file in your project root and add your Auth URL:
Replace the URL with your actual Auth URL from the Neon Console.
```bash
VITE_NEON_AUTH_URL=https://ep-xxx.neonauth.us-east-1.aws.neon.tech/neondb/auth
```
Create a `src/auth.ts` file to configure your auth client:
```typescript
import { createAuthClient } from '@neondatabase/neon-js/auth';
export const authClient = createAuthClient(import.meta.env.VITE_NEON_AUTH_URL);
```
Replace the contents of `src/main.tsx` to wrap your app with React Router and the auth provider. Import the Neon Auth UI CSS - no additional setup needed:
Pass props to `NeonAuthUIProvider` for any features you want to use. Only the `authClient` prop is required.
To learn more about applying styles to the Auth UI components, including plain CSS and Tailwind CSS v4 options, see [UI Component Styles](/docs/auth/reference/ui-components#styling).
Example: Adding optional props
```tsx
{children}
```
```tsx
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { NeonAuthUIProvider } from '@neondatabase/neon-js/auth/react';
import '@neondatabase/neon-js/ui/css';
import App from './App';
import { authClient } from './auth';
createRoot(document.getElementById('root')!).render(
);
```
Replace the contents of `src/App.tsx` with routes for authentication and account management:
The `` component handles navigation between sign-in and sign-up views.
The `` component provides account-management features such as password resets and session management.
```tsx
import { Routes, Route, useParams } from 'react-router-dom';
import {
AuthView,
AccountView,
SignedIn,
UserButton,
RedirectToSignIn,
} from '@neondatabase/neon-js/auth/react/ui';
function Home() {
return (
<>
);
}
export default function App() {
return (
} />
} />
} />
);
}
```
Start the development server, then open [http://localhost:5173](http://localhost:5173). You'll be redirected to the sign-in page where you can sign up or sign in.
```bash
npm run dev
```
As users sign up, their profiles are synced to your Neon database in the `neon_auth.user` table.
Query your users table in the SQL Editor to see your new users:
```sql
SELECT * FROM neon_auth.user;
```
## Next steps
- [Add email verification](/docs/auth/guides/email-verification)
- [Learn how to branch your auth](/docs/auth/branching-authentication)