mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(stencil): add stencil usage to components (#21261)
This commit is contained in:
@@ -158,6 +158,59 @@ export const TextAreaExamples: React.FC = () => {
|
||||
```
|
||||
|
||||
|
||||
### Stencil
|
||||
|
||||
```tsx
|
||||
import { Component, h } from '@stencil/core';
|
||||
|
||||
@Component({
|
||||
tag: 'textarea-example',
|
||||
styleUrl: 'textarea-example.css'
|
||||
})
|
||||
export class TextareaExample {
|
||||
render() {
|
||||
return [
|
||||
// Default textarea
|
||||
<ion-textarea></ion-textarea>,
|
||||
|
||||
// Textarea in an item with a placeholder
|
||||
<ion-item>
|
||||
<ion-textarea placeholder="Enter more information here..."></ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Textarea in an item with a floating label
|
||||
<ion-item>
|
||||
<ion-label position="floating">Description</ion-label>
|
||||
<ion-textarea></ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Disabled and readonly textarea in an item with a stacked label
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Summary</ion-label>
|
||||
<ion-textarea
|
||||
disabled
|
||||
readonly
|
||||
value="Ionic enables developers to build performant, high-quality mobile apps.">
|
||||
</ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Textarea that clears the value on edit
|
||||
<ion-item>
|
||||
<ion-label>Comment</ion-label>
|
||||
<ion-textarea clearOnEdit={true}></ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Textarea with custom number of rows and cols
|
||||
<ion-item>
|
||||
<ion-label>Notes</ion-label>
|
||||
<ion-textarea rows={6} cols={20} placeholder="Enter any notes here..."></ion-textarea>
|
||||
</ion-item>
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Vue
|
||||
|
||||
```html
|
||||
|
||||
49
core/src/components/textarea/usage/stencil.md
Normal file
49
core/src/components/textarea/usage/stencil.md
Normal file
@@ -0,0 +1,49 @@
|
||||
```tsx
|
||||
import { Component, h } from '@stencil/core';
|
||||
|
||||
@Component({
|
||||
tag: 'textarea-example',
|
||||
styleUrl: 'textarea-example.css'
|
||||
})
|
||||
export class TextareaExample {
|
||||
render() {
|
||||
return [
|
||||
// Default textarea
|
||||
<ion-textarea></ion-textarea>,
|
||||
|
||||
// Textarea in an item with a placeholder
|
||||
<ion-item>
|
||||
<ion-textarea placeholder="Enter more information here..."></ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Textarea in an item with a floating label
|
||||
<ion-item>
|
||||
<ion-label position="floating">Description</ion-label>
|
||||
<ion-textarea></ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Disabled and readonly textarea in an item with a stacked label
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Summary</ion-label>
|
||||
<ion-textarea
|
||||
disabled
|
||||
readonly
|
||||
value="Ionic enables developers to build performant, high-quality mobile apps.">
|
||||
</ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Textarea that clears the value on edit
|
||||
<ion-item>
|
||||
<ion-label>Comment</ion-label>
|
||||
<ion-textarea clearOnEdit={true}></ion-textarea>
|
||||
</ion-item>,
|
||||
|
||||
// Textarea with custom number of rows and cols
|
||||
<ion-item>
|
||||
<ion-label>Notes</ion-label>
|
||||
<ion-textarea rows={6} cols={20} placeholder="Enter any notes here..."></ion-textarea>
|
||||
</ion-item>
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user