npmsyntaxdefinitioninquirer

What is the difference between 'List' and 'Rawlist' when using Inquirer


I'm using inquirer and I can either make a 'list' type or a 'rawlist' type.

My goal is to allow the user to select an item from an array of products from a sql database, but I am now curious what the difference between these two list types are? In the documentation, the definitions are:

List - {type: 'list'} Take type, name, message, choices[, default, filter] properties. (Note that default must be the choice index in the array or a choice value)

and

Raw List - {type: 'rawlist'} Take type, name, message, choices[, default, filter] properties. (Note that default must be the choice index in the array)

but I don't understand what they mean, or their difference.


Solution

  • It looks to me like the difference is only in how the list is presented to the user. list presents them with a pointer that they can move up or down to make their selection, whereas rawlist presents them with a list to be selected by number. From what I can tell they behave identically in what they return.