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:
26
core/src/components/icon/usage/stencil.md
Normal file
26
core/src/components/icon/usage/stencil.md
Normal file
@@ -0,0 +1,26 @@
|
||||
```tsx
|
||||
import { Component, h } from '@stencil/core';
|
||||
|
||||
@Component({
|
||||
tag: 'icon-example',
|
||||
styleUrl: 'icon-example.css'
|
||||
})
|
||||
export class IconExample {
|
||||
render() {
|
||||
return [
|
||||
// uses "star" icon for both modes
|
||||
<ion-icon name="star"></ion-icon>,
|
||||
|
||||
// explicitly set the icon for each mode
|
||||
<ion-icon ios="home" md="star"></ion-icon>,
|
||||
|
||||
// use a custom svg icon
|
||||
<ion-icon src="/path/to/external/file.svg"></ion-icon>,
|
||||
|
||||
// set the icon size
|
||||
<ion-icon size="small" name="heart"></ion-icon>,
|
||||
<ion-icon size="large" name="heart"></ion-icon>
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user