| What is the rendering parameter? | Rendering parameter is a way to pass additional items or values on the presentation component rendering, apart from rendering data source. |
| When we use a rendering parameter? | It is a situation where content editors need additional items apart from its actual data source.
For Example, I used the Rendering Parameter to pass and additional CSS class to the component, which will allow my content editors to choose the style of their component. |
| How to use the rendering parameter? | There are three step activity to create and consume a rendering parameter.
1) Create Rendering Parameter Template. 2) Assign a Rendering Parameter to a respective component. 3) Retrieve or utilize the Rendering Parameter value in the code. |
- Create Rendering Parameter Template.
Create a new parameter Rendering template make sure creating template should inherit from “Standard Rendering Template” as shown below in the image.

Image: creating a rendering parameter template.
After creation template, Create the field as shown below in the image.

2) Assign a Rendering Parameter to a respective component.
Assign you parameter template on your required rendering under the Editor Options section of your rendering, as shown below

After referencing your Rendering Template to the respective rendering, as shown above in the image, check the same by going to the content item where you are using rendering parameter go to the
Presentation Details=> Final Layout
And select your rendering and click on edit – you can see your Rendering Parameter field there. As shown below.

3) Retrieve or utilize the Rendering Parameter value in the code.
- a) Read the rendering parameter value at the partial view.
var rc = Sitecore.Mvc.Presentation.RenderingContext.CurrentOrNull;
string styleName = string.Empty;
if (rc != null)
{
var parms = rc.Rendering.Parameters;
styleName = parms[“Css Name”];
}
I hope this post will help you in understanding the Rendering Parameter.
Happy Coding 🙂