-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Currently, it is not possible to provide customized labels to ion-select, rather, only the [label]="my label" attribute is supported. ion-select should be updated to support complex labels - bringing it in line with other components like ion-toggle.
Describe the Use Case
The new form syntax doesn't allow customization of ion-select labels. Making something like this impossible without using legacy <ion-label> code. We need the ability to add custom HTML / components to our labels. Plain text is not enough for our use cases:
Describe Preferred Solution
Pass through non-ion-select-option elements directly to the slot=label slot of ion-segment:
Use slot=label to provide custom label elements, like ion-range:
<ion-select placeholder="Choose one">
<div slot=label>View mode</div>
<ion-note slot=label>Choose how decks are presented visually when viewing or editing.</ion-note>
<ion-select-option value=foo>foo</ion-select-option>
</ion-select>
Additionally, I'd propose that ALL input components be updated to support slot=label as appropriate. It's an extra tripping point for developers to have to remember which of these components use slot=label and which accept label elements directly as children.
Passing elements as children and having them show up in label slot without requiring the slot=label attribute might also create additional migration scenarios in the future, should components start to use the Shadow DOM, or be re-worked to use slots in the future.
If everything required slot=label today, I think it would be more consistent for developers and more future-proof across the board.
Describe Alternatives
No response
Related Code
No response
Additional Information
No response
