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:
@@ -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
|
||||
|
||||
45
core/src/components/checkbox/usage/stencil.md
Normal file
45
core/src/components/checkbox/usage/stencil.md
Normal 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>
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user