material icon indicating copy to clipboard operation
material copied to clipboard

Labeling md-radio-group

Open anandshankar opened this issue 11 years ago • 7 comments

Hi Experts,

I am using md-radio-group/md-radio-button in one of my forms along with md-input-container/label/input tags.

I need two radio groups, say, 'My Most Preferred Work Location' and 'My Most Undesirable Work Location', with same set of radio buttons, say, 'Delhi', 'Mumbai', 'Pune', 'Bangalore'.

My problem is that I don't see any option to set a label for each of the radio groups, at least with the same look and feel as the input component.

Any suggestions to me how to achieve it or can we have some thing for labeling radio groups and check box groups similar to input components?

Best Regards Anand

anandshankar avatar Nov 29 '15 07:11 anandshankar

Your mean something like that?

You're right, it doesn't look as the other Material Labels... but I think that's by intention.

devversion avatar Nov 29 '15 09:11 devversion

Yup right. But can't imagine the intention. It looks so different in size and color from rest of the form.

anandshankar avatar Nov 29 '15 14:11 anandshankar

Yes I can feel the same. You have any ideas in styling that label?

devversion avatar Nov 29 '15 14:11 devversion

To make it consistent with Input component, it would be nice if allows a

  • If any of the radio buttons/ check boxes are selected, group's label should be styled similar to label of tag which has got focus or is already filled, if not, it should be styled as an input tag not in focus and not initial value. Of course, there wont be any floating feature as well as no different styles based on validation.
  • Secondly, similar to 's label in disabled state, radio group's label should also be styled accordingly.

anandshankar avatar Nov 29 '15 16:11 anandshankar

dup #5834

EladBezalel avatar Jan 09 '16 11:01 EladBezalel

I have the same requirement but with angular 6. I could not get any solution to style the label similar to same look and feel as the input component.

Also I looked into below link, https://codepen.io/jakobadam/pen/xqZoBR but it was angular 1, and I tried to replace md-input-container with mat-form-field but it throws below error. "mat-form-field must contain a MatFormFieldControl."

I am not sure what to do further. Could you please give some suggestions.

Thanks for your help.

ravidannani avatar Aug 20 '18 12:08 ravidannani

@ravidannani Please submit Angular Material questions here. This repo is for AngularJS Material.

Splaktar avatar Sep 04 '18 17:09 Splaktar