
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@teamboks/react
Advanced tools
A React SDK for managing permissions in Teamboks applications.
npm install @teamboks/react @teamboks/core
# or
yarn add @teamboks/react @teamboks/core
This package provides React-specific functionality (hooks, components, context). For core functionality like API configuration and direct permission checking, use @teamboks/core.
First, wrap your app with the TeamboksProvider and provide your API key:
import React from 'react';
import { TeamboksProvider } from '@teamboks/react';
import App from './App';
function Root() {
return (
<TeamboksProvider apiKey="your-api-key">
<App />
</TeamboksProvider>
);
}
export default Root;
Then use the usePermission hook to check permissions in your components:
import { usePermission } from '@teamboks/react';
function MyComponent() {
const { canActivate, isLoading, error } = usePermission({
feature: 'users',
action: 'edit',
role: 'admin'
});
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return (
<div>
{canActivate ? (
<button>Edit User</button>
) : (
<p>You don't have permission to edit users</p>
)}
</div>
);
}
For direct API usage without React hooks, use the core package:
import { init, permissions, API_CONFIG } from '@teamboks/core';
// Initialize with API key
init('your-api-key');
// Check permissions directly
const result = await permissions.check({
feature: 'users',
action: 'edit',
role: 'admin'
});
console.log('Permission granted:', result.status === 200);
<TeamboksProvider apiKey={string}>A React provider component that initializes the SDK with your API key and makes it available to child components.
apiKey: Your Teamboks API keychildren: React children componentsusePermission({ feature: string, action: string, role: string })A React hook that returns permission status with loading and error states.
feature: The feature to check permissions foraction: The action to check permissions forrole: The role to check permissions for{ canActivate: boolean, isLoading: boolean, error: Error | null }useTeamboks()A React hook that returns the Teamboks context, providing access to the current API key.
{ apiKey: string }: The current Teamboks contextFor framework-agnostic functionality, see @teamboks/core:
# Install dependencies
npm install
# Start development server
npm run dev
# Run tests
npm test
# Build
npm run build
MIT
FAQs
Teamboks React SDK for permission management
We found that @teamboks/react 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.