Umbraco Custom Dropdown Macro Property / Parameter

Image of Stephen Garside Stephen Garside | Mon 25 Nov 19 > 2 min read

The other day I was searching the web looking for an easy way to add my own dropdown list as a parameter / property on an Umbraco Macro.  There are plenty of articles out there, but none with a complete explanation of how to do this easily, within minutes - so here goes!


How To Add A Custom Dropdown Parameter To An Umbraco Macro

Step 1 - Download The Source Code

Download my custom dropdown umbraco macro parameter package from github and place it in your App_Plugins folder like so:-

custom dropdown umbraco macro parameter


Step 2 - IISReset

Do an IISReset on your machine to clear down any local Umbraco caching.


Step 3 - Create New Data Type

In your Umbraco CMS back-office > Developer section add a new DataType (in this example I have called mine 'Title Position'), and select the 'Title Position' in the Property editor field:-

How To Create Custom Data Type In Umbraco For Macros


Step 4 - Add The Dropdown to Your Macro

You are done! Now just select the new data type when adding a new parameter within your own macro:-

Adding A Custom Drop Down To An Umbraco Macro

To use the selected value from your custom dropdown umbraco macro parameter use the following razor syntax:-


Leave Your Comments...