> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-cms/13.latest/reference/templating/macros/partial-view-macros.md).

# Partial View Macros

Partial View Macros are the recommended macro type to use in Umbraco. They work in both MVC and Webforms and use the unified query syntax that is available via the `UmbracoHelper`.

## View/Model Type

All Partial View Macro views inherit from `Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage` and the header of each Partial View Macro file will contain:

```csharp
@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage
```

The model type for a Partial View Macro is `Umbraco.Cms.Core.Models.PartialViewMacroModel`. This contains all of the properties you need to render out content alongside some additional\
properties about the macro itself:

* MacroName
* MacroAlias
* MacroId
* MacroParameters

## File Information

By default, Partial View Macros are stored in this folder:

> \~/Views/MacroPartials

However, if you are bundling up Partial View Macros as part of a package, they can also exist in this folder:

> \~/App\_Plugins/\[YourPackageName]/Views/MacroPartials

Since Partial View Macros are a normal MVC partial view, their file extension is **cshtml**. All Partial View Macro views inherit from the following view class:

```csharp
Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage
```

Therefore, all files will contain the header (which is done automatically for you if creating Partial View Macros via the Umbraco backoffice):

```csharp
@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage
```

## Accessing Content

The syntax in Partial View Macros is similar to the [**MVC View**](/umbraco-cms/13.latest/reference/templating/mvc/views.md) syntax. In fact, they are driven by the exact same engine as MVC Views.

You can use @CurrentPage, @Model.Content, @Umbraco, ...

## Accessing Macro Parameters

You can access the macro's parameters using the:

* `MacroParameters` property on the model which is of type `IDictionary<string, object>`:

  ```csharp
  var myParam = Model.MacroParameters["aliasOfTheMacroParameter"];
  ```
* Typed GetParameterValue method in `Umbraco.Cms.Core.Models` namespace:

  ```csharp
  @using Umbraco.Cms.Core.Models;
  var myParam = Model.GetParameterValue<string>("aliasOfTheMacroParameter");
  ```
* Typed GetParameterValue method with the default value fallback:

  ```csharp
  @using Umbraco.Cms.Core.Models;
  var myParam = Model.GetParameterValue<string>("aliasOfTheMacroParameter", "default value if parameter value has not been set");
  ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.umbraco.com/umbraco-cms/13.latest/reference/templating/macros/partial-view-macros.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
