You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
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.
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](https://private-user-images.githubusercontent.com/92030419/312561728-ff9454f3-de8d-4c18-b9da-a7e6774ef508.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3MTE1OTIsIm5iZiI6MTcxOTcxMTI5MiwicGF0aCI6Ii85MjAzMDQxOS8zMTI1NjE3MjgtZmY5NDU0ZjMtZGU4ZC00YzE4LWI5ZGEtYTdlNjc3NGVmNTA4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDAxMzQ1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMwYzkwMWNkZTJjYjU4MGY5N2I1MWI1NDAxZGYyNmNjYzgwMzViMWFkYTIxYjNmMDNlOTFlNWE3N2EzNGFlNmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.QYUJlmwi299ogoPH4hNK_TlfDv0uIL6rJwmYUJbTlrU)
with:
ion-select::part(label) {
justify-content: center;
}
Expected Behavior
Item should have been centred
Steps to Reproduce
Code Reproduction URL
https://stackblitz.com/edit/angular-hfjbaw-mipybw?file=src%2Fapp%2Fexample.component.html
Ionic Info
ionic 7
Additional Information
No response
The text was updated successfully, but these errors were encountered: