# How to make a drop-down parameter? SOLVED

**URL:** <https://forum.makecode.com/t/how-to-make-a-drop-down-parameter-solved/3554>\
**Category:** micro:bit\
**Created:** [September 20, 2020, 3:17pm UTC](https://forum.makecode.com/t/how-to-make-a-drop-down-parameter-solved/3554 "2020-09-20T15:17:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![keble6](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@keble6](https://forum.makecode.com/u/keble6)\
**Post date:** [September 20, 2020, 3:17pm UTC](https://forum.makecode.com/t/how-to-make-a-drop-down-parameter-solved/3554/1 "2020-09-20T15:17:19Z")

</div>

I want to create a function block which has a **drop-down parameter** as well as normal number entry parameters. For example: ![Screenshot 2020-09-20 at 16.11.06](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/52e21e09367f7d1250a39e26ce542d2ed362ed77.png) - (this screenshot is from an approved “servos” extension).  
I can’t figure out what is needed in the TypeScript.

---

<div class="post-metadata">

**Author:** ![keble6](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@keble6](https://forum.makecode.com/u/keble6)\
**Post date:** [September 20, 2020, 4:51pm UTC](https://forum.makecode.com/t/how-to-make-a-drop-down-parameter-solved/3554/2 "2020-09-20T16:51:09Z")

</div>

I got it working (lots of trial and error!). Here is a sample JS code snippet:

```
    enum alarmNum {
    A1,
    A2
}
//NB this is OUTSIDE the namespace!!!

//% weight=20 color=#b77ff0 icon="\uf017" block="DS3231"
namespace DS3231 {
    /**
     * set alarm
     * @param name is the Alarm name
     * @param minute is the Minute that will be set, eg: 13
     * @param second is the Second that will be set, eg: 0
     */
    //% blockId="DS3231_SET_ALARM" block="set alarm %name| minute %minute|second %second"
    //% weight=60 blockGap
    //% parts=DS3231 trackArgs=0
    export function setAlarm(name: alarmNum, minute: number, second: number): void {
       
    }

}

```

The key things:

- The drop-down list is created in an enum (mine is called “alarmNum”) which is **outside** the namespace. That’s important!
- The list is given a name (I used “name”) and is defined in the function’s parameter list as being of type {enum-name} - so: _export function setAlarm(name: alarmNum,_

I did struggle with the documentation …

---

<div class="post-metadata">

**Author:** ![keble6](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@keble6](https://forum.makecode.com/u/keble6)\
**Post date:** [September 20, 2020, 4:53pm UTC](https://forum.makecode.com/t/how-to-make-a-drop-down-parameter-solved/3554/3 "2020-09-20T16:53:07Z")

</div>

A screenshot of the above example: ![Screenshot 2020-09-20 at 17.52.38](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/7/704f40838235f4aa4ffe80779e4bcd57781b5520.png)

---

<div class="post-metadata">

**Author:** ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)\
**Post date:** [September 21, 2020, 12:04pm UTC](https://forum.makecode.com/t/how-to-make-a-drop-down-parameter-solved/3554/4 "2020-09-21T12:04:03Z")

</div>

Nice!

For what it’s worth, the “playground” is a great resource for seeing a lot of the block alternatives and rapid prototyping: [https://makecode.com/playground](https://makecode.com/playground) (That’s a tip I picked up from this forum)
