Navegación Colapsable — Guía de Desarrollo y Admin UI
1. Instalación y Dependencias
Sección titulada «1. Instalación y Dependencias»pnpm add @vicacha-devs/strapi-plugin-collapsible-nav2. Configuración del Servidor (config/plugins.ts)
Sección titulada «2. Configuración del Servidor (config/plugins.ts)»Agregue la configuración del plugin en el archivo config/plugins.ts de su aplicación Strapi v5:
export default ({ env }: { env: (key: string, defaultValue?: string) => string }) => ({ "collapsible-nav": { enabled: true, config: { // No options: install, enable, and restart Strapi. }, },});3. Recorrido por la Interfaz de Administración (Strapi v5 Admin UI)
Sección titulada «3. Recorrido por la Interfaz de Administración (Strapi v5 Admin UI)»Una vez habilitado, el plugin registra su espacio de trabajo y ajustes dentro del panel de administración de Strapi v5 utilizando Strapi Design System v2:
Etiquetas Localizadas de la Interfaz (Español)
Sección titulada «Etiquetas Localizadas de la Interfaz (Español)»| Clave de Traducción | Texto en Interfaz |
|---|---|
plugin.name |
Navegación colapsable |
toggle.expand |
Expandir navegación |
toggle.collapse |
Colapsar navegación |
pin.pin |
Fijar barra lateral abierta |
pin.unpin |
Desfijar barra lateral (auto-colapsar) |
4. Entidades Content-Type, Ubicación y Esquemas (strapi.documents)
Sección titulada «4. Entidades Content-Type, Ubicación y Esquemas (strapi.documents)»Registers no Content-Types, routes, or server services (server/index.ts exports an empty object). The admin entry registers the plugin and calls initCollapsibleNav() once from bootstrap(): a DOM controller that finds Strapi’s main left navigation, adds a floating chevron toggle and a Pin/Unpin control, animates the width between 22.4rem (expanded) and 5.6rem (collapsed), and stores both choices in the browser’s localStorage (strapi-collapsible-nav:expanded and strapi-collapsible-nav:pinned). It only activates at Strapi’s large desktop breakpoint (>= 1080px).
Dónde Encontrar las Entidades Content-Type en Strapi v5
Sección titulada «Dónde Encontrar las Entidades Content-Type en Strapi v5»- Every Admin Page: the chevron toggle sits on the edge of the left navigation sidebar across
/admin/*, with the Pin/Unpin control next to it. - Browser Storage:
localStoragekeysstrapi-collapsible-nav:expandedandstrapi-collapsible-nav:pinned(per browser profile, not per Strapi user). - No Content-Types or API: this plugin creates no entities, routes, settings page, or database tables.
Este plugin opera dinámicamente sobre las entidades Content-Type existentes de Strapi (api::* y plugin::*).
Integración con el Content Manager de Strapi v5 (/admin/content-manager)
Sección titulada «Integración con el Content Manager de Strapi v5 (/admin/content-manager)»Grupo en la Barra Lateral del Content Manager:
Applies to Strapi's left navigation on every admin page, including all Content Manager screens
Entidades y Componentes en el Content Manager
Sección titulada «Entidades y Componentes en el Content Manager»- Strapi main left navigation (
NavBrand, menu links,NavUser), enhanced in place with a chevron toggle and a Pin/Unpin control - Browser
localStoragekeysstrapi-collapsible-nav:expandedandstrapi-collapsible-nav:pinned(no Content-Type, route, or database table is created)
Por Qué Este Plugin Crea e Integra Entidades en el Content Manager
Sección titulada «Por Qué Este Plugin Crea e Integra Entidades en el Content Manager»@vicacha-devs/strapi-plugin-collapsible-nav does not add fields or panels to Content Manager documents. It gives editors more horizontal room while they work in Content Manager lists and edit views by letting them collapse the left navigation that Strapi v5 does not collapse on desktop.
- Wider Content Manager Lists and Edit Views: collapse the sidebar to
5.6remicons to fit more columns and wider rich-text fields on screen. - Zero Configuration, Zero Server Footprint: install, enable, and restart Strapi; there are no options, routes, or install scripts.
- Per-Browser Preference: the expanded and pinned state is remembered in
localStorage, so each editor keeps their own layout.
Cómo Usarlo en el Content Manager de Strapi (Paso a Paso)
Sección titulada «Cómo Usarlo en el Content Manager de Strapi (Paso a Paso)»- Open Any Content Manager Screen: go to
/admin/content-manageron a desktop viewport (>= 1080px). - Click the Chevron Toggle: use the control on the sidebar edge to collapse or expand the navigation.
- Choose Pinned or Hover-to-Peek: use Pin/Unpin to keep the labels visible, or leave the sidebar compact and hover it to read the labels.
Sincronización entre el Content Manager y el Espacio del Plugin
Sección titulada «Sincronización entre el Content Manager y el Espacio del Plugin»Casos de Uso en el Content Manager y Flujos Editoriales
Sección titulada «Casos de Uso en el Content Manager y Flujos Editoriales»Content Manager Use Case 1 — Editing Wide Entries Without Horizontal Squeeze
Sección titulada «Content Manager Use Case 1 — Editing Wide Entries Without Horizontal Squeeze»- Para qué sirve y por qué usarlo: Keep wide Content Manager tables and multi-column edit views readable on laptop screens by collapsing the navigation to icons.
- Cómo ejecutarlo en el Content Manager: Open a collection in
/admin/content-manager, click the chevron toggle to collapse the sidebar, and reopen it later; the collapsed state is restored automatically.
5. Casos de Uso y Flujos de Trabajo
Sección titulada «5. Casos de Uso y Flujos de Trabajo»Use Case 1 — Reclaiming Workspace Width on Dense Admin Pages
Sección titulada «Use Case 1 — Reclaiming Workspace Width on Dense Admin Pages»- What it is for: Give editors more room for wide Content Manager tables, the Calendar, and the Media Library by collapsing the left navigation to icons only (
5.6rem). - How it works: Click the chevron toggle on the sidebar edge; the width animates between
22.4remand5.6remwhile icons, the brand logo, and the user avatar stay anchored. The choice is saved instrapi-collapsible-nav:expandedand restored on the next visit.
Use Case 2 — Compact Sidebar with Hover-to-Peek (Unpinned Mode)
Sección titulada «Use Case 2 — Compact Sidebar with Hover-to-Peek (Unpinned Mode)»- What it is for: Keep the navigation compact by default but still read the full labels on demand.
- How it works: Unpin the sidebar with the Pin/Unpin control: it stays at
5.6remand expands on hover, then collapses again. Pin it to keep the labels visible. The state is saved instrapi-collapsible-nav:pinned.
Use Case 3 — Localized, Theme-Aware Labels for Multilingual Teams
Sección titulada «Use Case 3 — Localized, Theme-Aware Labels for Multilingual Teams»- What it is for: Show tooltips and control labels in each editor’s language and in the active light or dark theme.
- How it works: The controller reads each menu link’s localized
aria-label(plus theNavBrandandNavUserlabels) so collapsed items keep readable tooltips; toggle and pin labels come from the plugin’sen,es,ar,fr, andtrtranslations registered throughregisterTrads, and colors follow Strapi’sSTRAPI_THEMEsetting or the system preference.
6. Endpoints REST API (content-api y admin)
Sección titulada «6. Endpoints REST API (content-api y admin)»| Método | Ruta del Endpoint | Ámbito | Controlador | Autenticación |
|---|
7. Uso Programático en el Servidor (strapi.plugin y strapi.documents)
Sección titulada «7. Uso Programático en el Servidor (strapi.plugin y strapi.documents)»// Registered services on plugin "collapsible-nav": "service"const pluginService = strapi.plugin("collapsible-nav")?.service("service");
// Retrieving plugin settings via Strapi plugin storeconst store = strapi.store({ type: "plugin", name: "collapsible-nav" });const settings = await store.get({ key: "settings" });8. Solución de Problemas y Verificación
Sección titulada «8. Solución de Problemas y Verificación»- Cambios no visibles en el panel Admin: Ejecute
pnpm strapi builddespués de editarconfig/plugins.ts. - Aislamiento de dependencias peer: Mantenga
hoistPattern: ["*", "!@strapi/*"]enpnpm-workspace.yamlpara evitar colisiones de contexto en React. - Verificación estricta de TypeScript: Ejecute
pnpm checkpara validaradmin/tsconfig.jsonyserver/tsconfig.json.