Icon Svelte Component

Icon Components

There are following components included:

  • Icon

Icon Props

NameTypeDefaultDescription
badgestring

Icon badge

badgeColorsobject

Badge colors. Object with Tailwind CSS colors classes

badgeColors.bgstring'bg-primary'

Badge bg color

badgeColors.textstring'text-white'

Badge text color

iosstring

Icon to render in "ios" theme

materialstring

Icon to render in "material" theme

Icon Slots

NameDescription
badge

Icon badge

ios

Icon to render in "ios" theme

material

Icon to render in "material" theme

Examples

Badge.svelte
<script>
import {
Page,
Navbar,
NavbarBackLink,
Badge,
Icon,
Link,
List,
ListItem,
Tabbar,
TabbarLink,
} from 'konsta/svelte';
import {
PersonCircleFill,
EnvelopeFill,
Calendar,
CloudUploadFill,
} from 'framework7-icons/svelte';
import MdPerson from '../components/MdPerson.svelte';
import MdEmail from '../components/MdEmail.svelte';
import MdToday from '../components/MdToday.svelte';
import MdFileUpload from '../components/MdFileUpload.svelte';
import DemoIcon from '../components/DemoIcon.svelte';
</script>
<Page>
<Navbar title="Badge">
<Link navbar iconOnly slot="right">
<Icon badge="5" badgeColors={{ bg: 'bg-red-500' }}>
<PersonCircleFill slot="ios" class="w-7 h-7" />
<MdPerson slot="material" class="w-6 h-6" />
</Icon>
</Link>
</Navbar>
<Tabbar labels class="left-0 bottom-0 fixed">
<TabbarLink active label="Inbox" withIcon>
<Icon slot="icon" badge="5" badgeColors={{ bg: 'bg-green-500' }}>
<EnvelopeFill slot="ios" class="w-7 h-7" />
<MdEmail slot="material" class="w-6 h-6" />
</Icon>
</TabbarLink>
<TabbarLink label="Calendar" withIcon>
<Icon slot="icon" badge="7" badgeColors={{ bg: 'bg-red-500' }}>
<Calendar slot="ios" class="w-7 h-7" />
<MdToday slot="material" class="w-6 h-6" />
</Icon>
</TabbarLink>
<TabbarLink label="Upload" withIcon>
<Icon slot="icon" badge="1" badgeColors={{ bg: 'bg-red-500' }}>
<CloudUploadFill slot="ios" class="w-7 h-7" />
<MdFileUpload slot="material" class="w-6 h-6" />
</Icon>
</TabbarLink>
</Tabbar>
<List>
<ListItem title="Foo Bar">
<DemoIcon slot="media" />
<Badge slot="after" colors={{ bg: 'bg-gray-500' }}>0</Badge>
</ListItem>
<ListItem title="Ivan Petrov">
<DemoIcon slot="media" />
<Badge slot="after">CEO</Badge>
</ListItem>
<ListItem title="John Doe">
<DemoIcon slot="media" />
<Badge slot="after" colors={{ bg: 'bg-green-500' }}>5</Badge>
</ListItem>
<ListItem title="Jane Doe">
<DemoIcon slot="media" />
<Badge slot="after" colors={{ bg: 'bg-yellow-500' }}>NEW</Badge>
</ListItem>
</List>
</Page>
Code licensed under MIT.
2021 © Konsta UI by nolimits4web.