docs(stencil): add stencil usage to components (#21261)

This commit is contained in:
Brandy Carney
2020-05-12 20:35:48 -04:00
committed by GitHub
parent 703ef5c992
commit 687122127c
177 changed files with 11207 additions and 897 deletions

View File

@@ -153,6 +153,55 @@ export const CheckboxExamples: React.FC = () => {
```
### Stencil
```tsx
import { Component, h } from '@stencil/core';
@Component({
tag: 'checkbox-example',
styleUrl: 'checkbox-example.css'
})
export class CheckboxExample {
private form = [
{ val: 'Pepperoni', isChecked: true },
{ val: 'Sausage', isChecked: false },
{ val: 'Mushroom', isChecked: false }
];
render() {
return [
// Default Checkbox
<ion-checkbox></ion-checkbox>,
// Disabled Checkbox
<ion-checkbox disabled={true}></ion-checkbox>,
// Checked Checkbox
<ion-checkbox checked={true}></ion-checkbox>,
// Checkbox Colors
<ion-checkbox color="primary"></ion-checkbox>,
<ion-checkbox color="secondary"></ion-checkbox>,
<ion-checkbox color="danger"></ion-checkbox>,
<ion-checkbox color="light"></ion-checkbox>,
<ion-checkbox color="dark"></ion-checkbox>,
// Checkboxes in a List
<ion-list>
{this.form.map(entry =>
<ion-item>
<ion-label>{entry.val}</ion-label>
<ion-checkbox slot="end" checked={entry.isChecked}></ion-checkbox>
</ion-item>
)}
</ion-list>
];
}
}
```
### Vue
```html

View File

@@ -0,0 +1,45 @@
```tsx
import { Component, h } from '@stencil/core';
@Component({
tag: 'checkbox-example',
styleUrl: 'checkbox-example.css'
})
export class CheckboxExample {
private form = [
{ val: 'Pepperoni', isChecked: true },
{ val: 'Sausage', isChecked: false },
{ val: 'Mushroom', isChecked: false }
];
render() {
return [
// Default Checkbox
<ion-checkbox></ion-checkbox>,
// Disabled Checkbox
<ion-checkbox disabled={true}></ion-checkbox>,
// Checked Checkbox
<ion-checkbox checked={true}></ion-checkbox>,
// Checkbox Colors
<ion-checkbox color="primary"></ion-checkbox>,
<ion-checkbox color="secondary"></ion-checkbox>,
<ion-checkbox color="danger"></ion-checkbox>,
<ion-checkbox color="light"></ion-checkbox>,
<ion-checkbox color="dark"></ion-checkbox>,
// Checkboxes in a List
<ion-list>
{this.form.map(entry =>
<ion-item>
<ion-label>{entry.val}</ion-label>
<ion-checkbox slot="end" checked={entry.isChecked}></ion-checkbox>
</ion-item>
)}
</ion-list>
];
}
}
```