
Company News
AWS Security Hub Adds Socket for Supply Chain Security
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.
@abpjs/account
Advanced tools
Authentication UI components for ABP Framework in React
@abpjs/account provides ready-to-use authentication components for ABP-based React applications. It includes login forms, registration pages, and multi-tenant switching functionality - all styled with Chakra UI and fully customizable.
This package is a React translation of the original @abp/ng.account Angular package, bringing the same reliable account management to React developers.
# Using npm
npm install @abpjs/account
# Using yarn
yarn add @abpjs/account
# Using pnpm
pnpm add @abpjs/account
This package requires the following peer dependencies:
npm install @abpjs/core @abpjs/theme-shared @chakra-ui/react @emotion/react @emotion/styled framer-motion react-hook-form zod
The simplest way to use this package is to add the pre-configured routes:
import { accountRoutes } from '@abpjs/account';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
const router = createBrowserRouter([
...accountRoutes,
// Your other routes
]);
function App() {
return <RouterProvider router={router} />;
}
import { LoginForm } from '@abpjs/account';
function LoginPage() {
const handleSuccess = () => {
// Redirect after successful login
navigate('/dashboard');
};
return (
<div>
<h1>Welcome Back</h1>
<LoginForm onSuccess={handleSuccess} />
</div>
);
}
import { RegisterForm } from '@abpjs/account';
function RegisterPage() {
const handleSuccess = () => {
// Redirect after successful registration
navigate('/login');
};
return (
<div>
<h1>Create Account</h1>
<RegisterForm onSuccess={handleSuccess} />
</div>
);
}
import { TenantBox } from '@abpjs/account';
function Header() {
return (
<header>
<TenantBox />
{/* Other header content */}
</header>
);
}
import { LoginPage, RegisterPage } from '@abpjs/account';
import { Routes, Route } from 'react-router-dom';
function App() {
return (
<Routes>
<Route path="/login" element={<LoginPage />} />
<Route path="/register" element={<RegisterPage />} />
</Routes>
);
}
A complete login form with username/email and password fields.
import { LoginForm } from '@abpjs/account';
<LoginForm
onSuccess={() => navigate('/dashboard')}
onError={(error) => console.error(error)}
showRegisterLink={true}
showForgotPassword={true}
/>
Props:
| Prop | Type | Default | Description |
|---|---|---|---|
onSuccess | () => void | - | Callback after successful login |
onError | (error: Error) => void | - | Callback on login error |
showRegisterLink | boolean | true | Show link to registration page |
showForgotPassword | boolean | true | Show forgot password link |
User registration form with validation.
import { RegisterForm } from '@abpjs/account';
<RegisterForm
onSuccess={() => navigate('/login')}
onError={(error) => console.error(error)}
showLoginLink={true}
/>
Props:
| Prop | Type | Default | Description |
|---|---|---|---|
onSuccess | () => void | - | Callback after successful registration |
onError | (error: Error) => void | - | Callback on registration error |
showLoginLink | boolean | true | Show link to login page |
Multi-tenant selection component.
import { TenantBox } from '@abpjs/account';
<TenantBox
onTenantChange={(tenant) => console.log('Tenant changed:', tenant)}
/>
Hook for implementing OAuth2 resource owner password flow.
import { usePasswordFlow } from '@abpjs/account';
function CustomLoginForm() {
const { login, isLoading, error } = usePasswordFlow();
const handleSubmit = async (data) => {
await login({
username: data.username,
password: data.password,
});
};
return (
<form onSubmit={handleSubmit}>
{/* Your custom form */}
</form>
);
}
All components use Chakra UI and can be styled using Chakra's theming system:
import { extendTheme, ChakraProvider } from '@chakra-ui/react';
const theme = extendTheme({
components: {
Button: {
defaultProps: {
colorScheme: 'blue',
},
},
},
});
function App() {
return (
<ChakraProvider theme={theme}>
<LoginForm />
</ChakraProvider>
);
}
Override validation schemas using Zod:
import { z } from 'zod';
const customLoginSchema = z.object({
username: z.string().email('Must be a valid email'),
password: z.string().min(8, 'Password must be at least 8 characters'),
});
The account module fully supports ABP's multi-tenant architecture:
import { TenantBox } from '@abpjs/account';
// Show tenant selector in your app header
function AppHeader() {
return (
<header>
<Logo />
<TenantBox />
<UserMenu />
</header>
);
}
This package is designed to work seamlessly with ABP Framework backends:
This package is part of the ABP React monorepo. Contributions are welcome!
LGPL-3.0 - See LICENSE for details.
FAQs
ABP Framework Account module for React - Translation of @abp/ng.account
The npm package @abpjs/account receives a total of 1 weekly downloads. As such, @abpjs/account popularity was classified as not popular.
We found that @abpjs/account demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.