function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phuc Nguyen 18Phuc Nguyen 18 

How to show picklist in LWC

Hello All,
I need help rendering picklist values as radion buttons.  This will be on a LWC with input fields.  So the selected radion button will need to match the picklist value when the record is saved.
Thank you,
 P
Best Answer chosen by Phuc Nguyen 18
ShirishaShirisha (Salesforce Developers) 
Hi Phuc,

Greetings!

Unfortunately,we do not have the exact code which will help you to achieve your requirement.However,you can find the sample LWC code to fetch the Picklist value and lightning component to show the values as Radio buttons.

https://sfdcmonkey.com/2019/08/29/fetch-picklist-values-lightning-web-component/

https://www.biswajeetsamal.com/blog/get-picklist-values-dynamically-in-lightning-radio-group-component/

Hope the above links will help you in initiating the code for making the values of picklist as radio buttons in your code.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri

All Answers

ShirishaShirisha (Salesforce Developers) 
Hi Phuc,

Greetings!

Unfortunately,we do not have the exact code which will help you to achieve your requirement.However,you can find the sample LWC code to fetch the Picklist value and lightning component to show the values as Radio buttons.

https://sfdcmonkey.com/2019/08/29/fetch-picklist-values-lightning-web-component/

https://www.biswajeetsamal.com/blog/get-picklist-values-dynamically-in-lightning-radio-group-component/

Hope the above links will help you in initiating the code for making the values of picklist as radio buttons in your code.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
This was selected as the best answer
Phuc Nguyen 18Phuc Nguyen 18
Hello Shirisha,
Thnak you for the reply.  The sfdcmonkey seems close but I am not populating a picklist on the LWC but radion buttons.  Do I populate the radion buttons the same way as they do the picklist vlaues?
Thanks,
ShirishaShirisha (Salesforce Developers) 
Hi,

I haven't found the sample code to create the Radio button using the picklist values in the LWC.But,we have the lightning component to achieve the same in the second link that I have provided which is as below:

https://www.biswajeetsamal.com/blog/get-picklist-values-dynamically-in-lightning-radio-group-component/

I would suggest you to check the code and proceed accordingly.

Thank you!