-
Notifications
You must be signed in to change notification settings - Fork 13.5k
feat: custom html label for input and textarea with modern form syntax #27061
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
Comments
Thanks for the report. This feature requires that However, you can continue using <ion-item>
<ion-label id="my-label">My Label</ion-label>
<ion-input aria-labelledby="my-label"></ion-input>
</ion-item> Can you give this a try, and let me know if it works? |
Thanks for your response @liamdebeasi <ion-item>
<ion-label [position]="'stacked'">SomeField<small><i>Optional</i></small></ion-label>
<ion-input [label]="''" [labelPlacement]="'stacked'" [placeholder]="'please input'"></ion-input>
</ion-item> |
Are you using Here is an example that uses |
Thanks for your advise and I have done another test with the latest
and it works without any [Ionic Warning] in the console but I do not want to assign Sorry for the late reply |
Manually associating the input with the label is our recommended approach right now. Unfortunately, we are not able to add custom HTML support to I am going to close this for now, but let me know if you have questions. |
At least update documentation about how to make html work in labels. Haven't found one. |
Definitely not ideal, but you can do something like this: ion-input.custom-input .label-text::after {
content: "*";
color: red;
} |
Should issue be reopened? Bug https://bugs.webkit.org/show_bug.cgi?id=172567 for webkit already marked as resolved fixed if you were waiting for it. having id to use 'aria-labelledby' for each input (especially with arrays of forms) make development less pleasant than in ionic 6 and makes migration to 7 more risky. |
We've had a few people ask about this, so I am going to re-open for visibility. The linked WebKit has been resolved, but it's only applicable to iOS 16. We support back to iOS 14 so there are many iOS users who have not received the WebKit fix. If you need complex HTML support we recommend associating an |
Issue number: resolves #27061 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Input does not accept custom HTML labels ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Input accepts custom HTML labels as an experimental feature. We marked this as experimental because it makes use of "scoped slots" which is an emulated version of Web Component slots. As a result, there may be instances where the slot behavior does not exactly match the native slot behavior. Note to reviewers: This is a combination of previously reviewed PRs. The implementation is complete, so feel free to bikeshed. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Docs PR: ionic-team/ionic-docs#2997 --------- Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
Issue number: resolves #27061 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Textarea does not accept custom HTML labels ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Textarea accepts custom HTML labels as an experimental feature. We marked this as experimental because it makes use of "scoped slots" which is an emulated version of Web Component slots. As a result, there may be instances where the slot behavior does not exactly match the native slot behavior. Note to reviewers: This is a combination of previously reviewed PRs. The implementation is complete, so feel free to bikeshed. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Docs PR: ionic-team/ionic-docs#3001 --------- Co-authored-by: ionitron <hi@ionicframework.com>
Hi everyone, We will be adding experimental support to both The work required to add this functionality has been completed, so I am going to close this. Thanks! |
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
Describe the Feature Request
Inline html template for label on
ion-input
Describe the Use Case
with ionic@6.x I'm able to add some html and styles the label text like code below
but now with ionic@7.x the
<ion-lable>
component is discouraged and the[label]
property ofion-input
seems accepts strings onlyso is there a workaround to get this done like before?
Describe Preferred Solution
No response
Describe Alternatives
No response
Related Code
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: