-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(input): add label slot and no visible label demos #2997
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
Changes from 3 commits
044fe6d
dcb751c
5a24cfe
80dff9a
2cd03f1
cd40556
4b61278
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ```html | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input labelPlacement="floating" value="hi@ionic.io"> | ||
| <div slot="label">Email <ion-text color="danger">(Required)</ion-text></div> | ||
| </ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>input</title> | ||
| <link rel="stylesheet" href="../../../common.css" /> | ||
| <script src="../../../common.js"></script> | ||
| <script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@7.0.11-dev.11686769094.1eb95367/dist/ionic/ionic.esm.js"></script> | ||
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@7.0.11-dev.11686769094.1eb95367/css/ionic.bundle.css" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-content> | ||
| <div class="container"> | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input label-placement="floating" value="hi@ionic.io"> | ||
| <div slot="label">Email <ion-text color="danger">(Required)</ion-text></div> | ||
| </ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| </div> | ||
| </ion-content> | ||
| </ion-app> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import Playground from '@site/src/components/global/Playground'; | ||
|
|
||
| import javascript from './javascript.md'; | ||
| import react from './react.md'; | ||
| import vue from './vue.md'; | ||
| import angular from './angular.md'; | ||
|
|
||
| <Playground | ||
| version="7" | ||
| code={{ javascript, react, vue, angular }} | ||
| src="usage/v7/input/label-slot/demo.html" | ||
| /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ```html | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input label-placement="floating" value="hi@ionic.io"> | ||
| <div slot="label">Email <ion-text color="danger">(Required)</ion-text></div> | ||
| </ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ```tsx | ||
| import React from 'react'; | ||
| import { IonInput, IonItem, IonList, IonText } from '@ionic/react'; | ||
|
|
||
| function Example() { | ||
| return ( | ||
| <IonList> | ||
| <IonItem> | ||
| <IonInput labelPlacement="floating" value="hi@ionic.io"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label is not floating in the StackBlitz example
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The StackBlitz examples are using the latest version of Ionic which does not have the slotted label feature. As a result, passing a label to the input will not work as expected. If you manually install the dev build (
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh weird that it works for the other frameworks though |
||
| <div slot="label">Email <IonText color="danger">(Required)</IonText></div> | ||
| </IonInput> | ||
| </IonItem> | ||
| </IonList> | ||
| ); | ||
| } | ||
| export default Example; | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| ```html | ||
| <template> | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input label-placement="floating" value="hi@ionic.io"> | ||
| <div slot="label">Email <ion-text color="danger">(Required)</ion-text></div> | ||
| </ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| import { IonInput, IonItem, IonList, IonText } from '@ionic/vue'; | ||
| import { defineComponent } from 'vue'; | ||
|
|
||
| export default defineComponent({ | ||
| components: { IonInput, IonItem, IonList, IonText }, | ||
| }); | ||
| </script> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ```html | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input aria-label="Email" value="hi@ionic.io"></ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>input</title> | ||
| <link rel="stylesheet" href="../../../common.css" /> | ||
| <script src="../../../common.js"></script> | ||
| <script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@7/dist/ionic/ionic.esm.js"></script> | ||
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@7/css/ionic.bundle.css" /> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-content> | ||
| <div class="container"> | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input aria-label="Email" value="hi@ionic.io"></ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| </div> | ||
| </ion-content> | ||
| </ion-app> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import Playground from '@site/src/components/global/Playground'; | ||
|
|
||
| import javascript from './javascript.md'; | ||
| import react from './react.md'; | ||
| import vue from './vue.md'; | ||
| import angular from './angular.md'; | ||
|
|
||
| <Playground | ||
| version="7" | ||
| code={{ javascript, react, vue, angular }} | ||
| src="usage/v7/input/no-visible-label/demo.html" | ||
| /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ```html | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input aria-label="Email" value="hi@ionic.io"></ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ```tsx | ||
| import React from 'react'; | ||
| import { IonInput, IonItem, IonList } from '@ionic/react'; | ||
|
|
||
| function Example() { | ||
| return ( | ||
| <IonList> | ||
| <IonItem> | ||
| <IonInput aria-label="Email" value="hi@ionic.io"></IonInput> | ||
| </IonItem> | ||
| </IonList> | ||
| ); | ||
| } | ||
| export default Example; | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ```html | ||
| <template> | ||
| <ion-list> | ||
| <ion-item> | ||
| <ion-input aria-label="Email" value="hi@ionic.io"></ion-input> | ||
| </ion-item> | ||
| </ion-list> | ||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| import { IonInput, IonItem, IonList } from '@ionic/vue'; | ||
| import { defineComponent } from 'vue'; | ||
|
|
||
| export default defineComponent({ | ||
| components: { IonInput, IonItem, IonList }, | ||
| }); | ||
| </script> | ||
| ``` |
Uh oh!
There was an error while loading. Please reload this page.