Badge React component represents Badge element that can be used in lists, links, navigation bars, etc.
There are following components included:
Badge
Name | Type | Default | Description |
---|---|---|---|
colors | object | Object with Tailwind CSS colors classes | |
colors.bg | string | 'bg-primary' | Badge bg color |
colors.text | string | 'text-white' | Badge text color |
component | string | 'span' | Component's HTML Element |
small | boolean | Makes small badge |
import React from 'react';import {Page,Navbar,NavbarBackLink,Badge,Icon,Link,List,ListItem,Tabbar,TabbarLink,} from 'konsta/react';import {PersonCircleFill,EnvelopeFill,Calendar,CloudUploadFill,} from 'framework7-icons/react';import { MdPerson, MdEmail, MdToday, MdFileUpload } from 'react-icons/md';import DemoIcon from '../components/DemoIcon';export default function BadgePage() {return (<Page><Navbartitle="Badge"right={<Link navbar iconOnly><Iconios={<PersonCircleFill className="w-7 h-7" />}material={<MdPerson className="w-6 h-6" />}badge="5"badgeColors={{ bg: 'bg-red-500' }}/></Link>}/><Tabbar labels icons className="left-0 bottom-0 fixed"><TabbarLinkactiveicon={<Iconios={<EnvelopeFill className="w-7 h-7" />}material={<MdEmail className="w-6 h-6" />}badge="5"badgeColors={{ bg: 'bg-green-500' }}/>}label="Inbox"/><TabbarLinkicon={<Iconios={<Calendar className="w-7 h-7" />}material={<MdToday className="w-6 h-6" />}badge="7"badgeColors={{ bg: 'bg-red-500' }}/>}label="Calendar"/><TabbarLinkicon={<Iconios={<CloudUploadFill className="w-7 h-7" />}material={<MdFileUpload className="w-6 h-6" />}badge="1"badgeColors={{ bg: 'bg-red-500' }}/>}label="Upload"/></Tabbar><List strong inset><ListItemmedia={<DemoIcon />}title="Foo Bar"after={<Badge colors={{ bg: 'bg-gray-500' }}>0</Badge>}/><ListItemmedia={<DemoIcon />}title="Ivan Petrov"after={<Badge>CEO</Badge>}/><ListItemmedia={<DemoIcon />}title="John Doe"after={<Badge colors={{ bg: 'bg-green-500' }}>5</Badge>}/><ListItemmedia={<DemoIcon />}title="Jane Doe"after={<Badge colors={{ bg: 'bg-yellow-500' }}>NEW</Badge>}/></List></Page>);}