# Modules {% module %}

Refer to: [https://developers.hubspot.com/docs/cms/building-blocks/modules/using-modules-in-templates](https://developers.hubspot.com/docs/cms/building-blocks/modules/using-modules-in-templates)

You must first create a module before you can use this tag. Then, you can use this to reference a module and use it in a template.

This will be our custom module.

[![image.png](https://wiki.danicus.net/uploads/images/gallery/2023-10/scaled-1680-/JjhBFMMvDxveqwef-image.png)](https://wiki.danicus.net/uploads/images/gallery/2023-10/JjhBFMMvDxveqwef-image.png)

---

Module tag / Module name / Module Path / Parameters /

- Module name = gives the module a unique identity in the context of the template.
- Path = always start with `@hubspot/` followed by the type of module (unless its custom).
- Parameters = are comma-separated, key-value pairs 
    - Requires double or single quotes 
        - Boolean - no quotes needed for `True` or `False` values.

```
{% module "unique_module_name" path="@hubspot/module_type" %}
```

Examples:

```
{# Basic syntax #}
{% module "unique_module_name" path="@hubspot/module_type",
  parameterString='String parameter value',
  parameterBoolean=True
%}

{# Sample of a default HubSpot text module #}
{% module "job_title" path="@hubspot/text",
  label="Job Title",
  value="Chief Morale Officer"
%}

{# Sample of a custom module #}
{% module "faqs" path="/myWebsite/modules/faq_module",
  label="Custom FAQ Module"
  faq_group_title="Commonly Asked Questions"
%}
```

---

#### Setting default values for style fields

```
{% dnd_module
    path="./path/to/module",
    styles={
      "background_color":{
          "color":"#123",
          "opacity":50
       }
    }
%}
```