druxt-menu
druxt-menu
npm i druxt-menu
druxt-menu

druxt-menu

The Fully Decoupled Drupal Framework

by druxt

0.19.0 (see all)License:MITTypeScript:Not Found
npm i druxt-menu
Readme

DruxtMenu

npm CircleCI Known Vulnerabilities codecov

Drupal Menu and Menu item Druxt components, with support for the JSON:API Menu Items module.

Install

$ npm install druxt-menu

Nuxt.js

Add module to nuxt.config.js

module.exports = {
  modules: ['druxt-menu'],
  druxt: {
    baseUrl: 'https://demo-api.druxtjs.org',
    menu: {
      query: {
        requiredOnly: true,
        fields: [],
      },
    },
  },
}

Usgae

DruxtMenu component

The DruxtMenu component inteligentally loads in your Drupal menu using the built in JSON:API as well as the Drupal JSON:API Menu Items module.

<DruxtMenu name="main" :depth="1" />

Example DruxtMenu component

See the DruxtMenu API Documentation for more information.

Theming

The DruxtMenu component can be themed by providing a default template:

<DruxtMenu name="main">
  <template #default="{ items }">
    {{ items }}
  </template>
</DruxtMenu>

The module also provides Wrapper components with scoped slots for theming:

<template>
  <div>
    <slot />
  <div>
</template>

See the Druxt Theming guide for more information.

Options

Druxt Menu options

These options are specific to this module.

OptionTypeRequiredDefaultDescription
menu.jsonApiMenuItemsbooleanNofalseUse the Drupal JSON:API Menu Items module resource.
menu.query.fieldsstring[]NofalseAn array of fields to filter all JSON:API Menu queries.
menu.query.requiredOnlybooleanNofalseWhether to automatically filter to module defined minimum required fields.

Base Druxt options

These options are available to all Druxt modules.

OptionTypeRequiredDefaultDescription
axiosobjectNo{}Axios instance settings.
baseUrlstringYesnullBase URL for the Drupal installation.
endpointstringNo/jsonapiJSON:API Endpoint of the Drupal installation.
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate