get value of radio is checked in lightning web component -- w3web.net

Create horizontal tabs uses of selected radio group button using ‘lightning-radio-group’ element and display selected radio value in Salesforce Lightning Web Component — LWC | How to display selected radio value in lwc

Hey guys, today in this post we are going to learn about LWC how to Create horizontal tabs uses of selected radio group button value using ‘lightning-radio-group’ element and display selected radio value in Salesforce Lightning Web Component — LWC.

A lightning-radio-group component represents a group of radio buttons that permit only one button to be selected at a time. The component renders radio button input elements and assigns the same value to the name attribute for each element. The common name attribute joins the elements in a group. If you select any radio button in that group, any previously selected button in the group is deselected. To know more, click here..

To create radio buttons, pass in the following properties to the options attribute.

PROPERTY TYPE DESCRIPTION
label string The text that displays next to a radio button.
value string The string that’s used to identify which radio button is selected.

The radio group is nested in a fieldset element that contains a legend element. The legend contains the label value. The fieldset element enables grouping of related radio buttons to facilitate tabbing navigation and speech navigation for accessibility purposes. Similarly, the legend element improves accessibility by enabling a caption to be assigned to the fieldset.

lightning-radio-group is available in the Base Components Recipes GitHub repository. It’s transpiled into the c namespace so that you can use it in your own projects.

Component Styling

lightning-radio-group implements the radio button blueprint in the Salesforce Lightning Design System (SLDS).

Set type=”button” to create a component that implements the radio button group blueprint in SLDS.

Variant attribute of radio group

  • label-hidden hides the radio group label but makes it available to assistive technology. This variant does not hide the option labels.
  • label-inline horizontally aligns the label and radio group.
  • label-stacked places the label above the radio group.
  • standard is the default variant, which displays the radio group label above the options.

 

 

Files we used in this post example

 

lwcRadioButtonGroup.html LWc HTML File Template HTML file to get selected radio group button value in Salesforce Lightning Web Component (LWC)
lwcRadioButtonGroup.js LWC JavaScript File It’s hold a javascript on handlechange function to get selected radio group button value and display in lightning component.
lwcRadioButtonGroup.js-meta.xml XML Meta File It is used to where this lightning web component file you want to display as like lightning__AppPage, lightning__RecordPage, lightning__HomePage.

 

Final Output

get value of radio is checked in lightning web component -- w3web.net

Other related post that would you like to learn in LWC

 

  • Find the below steps

Create Lightning Web Component HTML

Step 1:- Create Lightning Web Component HTML ➡ lwcRadioButtonGroup.html

SFDX:Lightning Web Component ➡ New ➡ lwcRadioButtonGroup.html

lwcRadioButtonGroup.html [Lightning Web Component HTML]

Create Lightning Web Component Javascript

Step 2:- Create Lightning Web Component Javascript ➡ lwcRadioButtonGroup.js

SFDX:Lightning Web Component ➡ New ➡ lwcRadioButtonGroup.js

lwcRadioButtonGroup.js [LWC JavaScript File]

Create Lightning Web Component Meta XML

Step 3:- Create Lightning Web Component Meta XML ➡ lwcRadioButtonGroup.js-meta.xml

SFDX:Lightning Web Component ➡ New >> lwcRadioButtonGroup.js-meta.xml

lwcRadioButtonGroup.js-meta.xml [LWC Meta Data XML]

Create Lightning Application

Step 4:- Create Lightning Application : lwcRadioButtonGroupApp.app

From Developer Console ➡ File ➡ New ➡ Lightning Application

lwcRadioButtonGroupApp.app [Component Application File]

 

 

 

Further post that would you like to learn in LWC

 

 

 

 

To Find Some Important Additional Information

If you think you and your family members also like to earn money in additional time, then go this link. In this site, you can earn money for the lifetime at low effort. To Earn Unlimited Everyday With This Trick, Sign Up Free and Get Magic.. Get Started for Free

Check Out Youtube:- Earn Unlimited Everyday With This Trick:- Click Here

 

FAQ (Frequently Asked Questions)

Q1 - What is button group in radio button?

Radio buttons are groups of buttons that response return true or false. We can be selected only one at a time.

Related Topics | You May Also Like

Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time.

5 thoughts on “Create horizontal tabs uses of selected radio group button using ‘lightning-radio-group’ element and display selected radio value in Salesforce Lightning Web Component — LWC | How to display selected radio value in lwc”

Leave a Comment