Skip to content

bug: ion-radio label cannot be centered in v7 #27929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
RRGT19 opened this issue Aug 3, 2023 · 2 comments
Closed
3 tasks done

bug: ion-radio label cannot be centered in v7 #27929

RRGT19 opened this issue Aug 3, 2023 · 2 comments
Labels

Comments

@RRGT19
Copy link

RRGT19 commented Aug 3, 2023

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

Using v6, we have a layout to show 2 ion-radio in a row with the container and the mark hidden/removed.

Screenshot 2023-08-03 at 3 12 29 PM

Now during the migration to v7, we cannot achieve the same style. The radio label cannot be moved to the center of the container. At least not with our knowledge of CSS so far.

Screenshot 2023-08-03 at 3 14 42 PM

The docs does not mention how to achieve a style without the container/mark.

  <ion-radio-group [(ngModel)]="value"
                   (ionChange)="onChange(value)"
                   [value]="value">

    <ion-row class="radio-tags">

      <ion-item class="radio-tag"
                lines="none"
                [class.item-checked]="isChecked(i)"
                *ngFor="let i of items">

        <div class="radio-inner-wrapper">

          <ion-radio justify="start"
                     labelPlacement="end"
                     [value]="i.value"
                     [disabled]="disabled"
                     (ionBlur)="onTouched()">

            {{i.label}}

          </ion-radio>

        </div>

      </ion-item>

    </ion-row>

  </ion-radio-group>

For the CSS check the code reproduction.

Expected Behavior

I would expect the ion-radio to be flexible if the container and the mark is removed to accomplish custom styles.

Steps to Reproduce

  1. Implement ion-radio-group with a ion-radio-group inside a container (div, ion-item, etc..)
  2. Hide the ion-radio container and the mark
  3. Try to center the ion-radio label

Code Reproduction URL

https://github.com/RRGT19/demo-ion-radio-label-center

Ionic Info

Ionic:

Ionic CLI : 7.1.1 (/.nvm/versions/node/v16.20.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.2.2
@angular-devkit/build-angular : 16.1.6
@angular-devkit/schematics : 16.1.6
@angular/cli : 16.1.6
@ionic/angular-toolkit : 10.0.0

Capacitor:

Capacitor CLI : 5.2.2
@capacitor/android : 5.2.2
@capacitor/core : 5.2.2
@capacitor/ios : 5.2.2

Utility:

cordova-res : not installed globally
native-run : 1.7.2

System:

NodeJS : v16.20.1 (/.nvm/versions/node/v16.20.1/bin/node)
npm : 9.8.0
OS : macOS Unknown

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Aug 3, 2023
@liamdebeasi liamdebeasi self-assigned this Aug 3, 2023
@liamdebeasi
Copy link
Contributor

Thanks for the report. This should be resolved by #27229.

We plan to add properties that allow you to center the label in a container. For example, you will be able to do something like this: <ion-radio labelPlacement="stacked" align="center">My Label</ion-radio>.

I am going to merge this with the linked issue.

@liamdebeasi liamdebeasi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2023
@liamdebeasi liamdebeasi removed their assignment Aug 3, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 2, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants