New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@wpmvc/admin-sidebar

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wpmvc/admin-sidebar

Professional React hooks for WordPress admin interfaces with complete sidebar management and responsive layout control.

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

@wpmvc/admin-sidebar

npm downloads License Bundle Size TypeScript

Professional React hooks for WordPress admin interfaces with complete sidebar management and responsive layout control.

Features

Dual Hook System

  • useActiveAdminMenu - Intelligent menu highlighting
  • useAdminSidebarLayout - Real-time sidebar state tracking

🚀 Seamless Integration

  • HashRouter support
  • Automatic responsive layout adjustments

Performance Optimized

  • Lightweight (under 2KB gzipped)
  • Zero unnecessary re-renders
  • Efficient DOM operations

Installation

npm install @wpmvc/admin-sidebar react-router-dom  
# or  
yarn add @wpmvc/admin-sidebar react-router-dom  

Usage

With React Router

import { HashRouter, useLocation, useNavigate, Outlet } from 'react-router-dom';
import { useActiveAdminMenu, useAdminSidebarLayout } from '@wpmvc/admin-sidebar';

const Layout = () => {
	// Required hooks
	const navigate = useNavigate();
	const location = useLocation();
	const { left, top } = useAdminSidebarLayout();

	// Initialize menu management
	useActiveAdminMenu( {
		pageTopLevelID: '#toplevel_page_my-plugin',
		rootPaths: [ '#/', '#/dashboard' ],
		navigate,
		location,
	} );

	return (
		<div
			style={ {
				marginLeft: left,
				marginTop: top,
				transition: 'margin-left 0.3s ease',
			} }
		>
			<Outlet />
		</div>
	);
};

// Entry point
export default () => (
	<HashRouter>
		<Route element={ <Layout /> }>
			{ /* Add your route items */ }
		</Route>
	</HashRouter>
);

📚 API Reference

useActiveAdminMenu(config: ActiveMenuConfig)

Required Configuration:

PropTypeDescription
pageTopLevelIDstringExact jQuery selector for menu wrapper
rootPathsstring[]Base paths (must include # prefix)
navigateFrom useNavigate()
locationFrom useLocation()

useAdminSidebarLayout(): SidebarLayout

Return Object:

PropertyTypeExample Value
leftnumber190px (expanded)
topnumber32px (admin bar)

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you'd like to contribute to the project.

Keywords

wordpress

FAQs

Package last updated on 19 Jun 2025

Did you know?

Socket

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.

Install

Related posts