Skip to content

feat: stacked labels for form controls #27229

Closed
@anddorua

Description

@anddorua

Prerequisites

Describe the Feature Request

Controls should be able to work with external labels. I.e. for any control sibling <label for="control-id">Text</label> might be attached and pressing on this label should apply focus on the control.

Describe the Use Case

Right now in v.7.0.1 I can't attach labels to the ion-checkbox elements to implement the following layout:
image

with this code:

<div class="week-container" formGroupName="weekDays">
  <label
    *ngFor="let day of weekDays; let i = index"
    for="day{{ i }}"
    class="label"
    >{{ day }}</label
  >
  <ion-checkbox
    *ngFor="let control of dayArray.controls; let i = index"
    formControlName="{{ i }}"
    id="day{{ i }}"
  ></ion-checkbox>
</div>

Describe Preferred Solution

No response

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions