Skip to content
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

bug: ion select shadow dom lable can not be used in angular #29157

Closed
3 tasks done
JingLeiTalan opened this issue Mar 13, 2024 · 2 comments
Closed
3 tasks done

bug: ion select shadow dom lable can not be used in angular #29157

JingLeiTalan opened this issue Mar 13, 2024 · 2 comments
Assignees
Labels

Comments

@JingLeiTalan
Copy link

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

in an angular projet, i have

Apples
Oranges
Bananas

if i want to center like this:
image

with:
ion-select::part(label) {
justify-content: center;
}

Expected Behavior

Item should have been centred

Steps to Reproduce

  1. https://stackblitz.com/edit/angular-hfjbaw-mipybw?file=src%2Fapp%2Fexample.component.html

Code Reproduction URL

https://stackblitz.com/edit/angular-hfjbaw-mipybw?file=src%2Fapp%2Fexample.component.html

Ionic Info

ionic 7

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Mar 13, 2024
@JingLeiTalan JingLeiTalan changed the title bug: ion select shadow dom lable can not be used bug: ion select shadow dom lable can not be used in angular Mar 13, 2024
@liamdebeasi
Copy link
Contributor

Thanks for the report. It sounds like you want the select to be centered within a container. If so, then justify-content: center is likely not what you want here. Your CSS controls the justification of content within the label, but your example doesn't use a label. As a result, your CSS is going to have no effect.

Instead, you should instruct ion-select to use the minimum intrinsic width. Here's a demo of the select in a toolbar (to show that it is centered within a container): https://codepen.io/liamdebeasi/pen/BaELBjv

I'd recommend setting a minimum overall width too otherwise the dimensions will change based on the size of the selected content. You can also optionally move the toggle icon so it moves all the way to the end of the select (which I show in the demo). I am going to close this since the desired behavior is already available in Ionic, but let me know if you have questions.

@liamdebeasi liamdebeasi closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
Copy link

ionitron-bot bot commented Apr 12, 2024

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 Apr 12, 2024
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

3 participants