Tabbar is a particular case of Toolbar, but it contains icons (or icons with labels) instead of plain links and inteded to be used to switch Tabs
There are following components included:
Tabbar
TabbarLink
Tabbar
component extends Toolbar
component, it supports all Toolbar
props and the following additional props:
Name | Type | Default | Description |
---|---|---|---|
icons | boolean | false | Enables Tabbar with icons |
labels | boolean | false | Enables Tabbar with labels |
TabbarLink
component extends Link
component, it supports all Link
props and the following additional props:
Name | Type | Default | Description |
---|---|---|---|
active | boolean | false | Makes this tabbar link active |
component | string | 'a' | Component's HTML Element |
icon | ReactNode | Link icon content | |
label | ReactNode | Link label content | |
linkProps | any | Object with additional props (attributes) to pass to the Link/Button |
import React, { useState } from 'react';import {Page,Navbar,NavbarBackLink,Tabbar,TabbarLink,Block,Icon,List,ListItem,Toggle,} from 'konsta/react';import {EnvelopeFill,Calendar,CloudUploadFill,} from 'framework7-icons/react';import { MdEmail, MdToday, MdFileUpload } from 'react-icons/md';export default function TabbarPage() {const [activeTab, setActiveTab] = useState('tab-1');const [isTabbarLabels, setIsTabbarLabels] = useState(true);const [isTabbarIcons, setIsTabbarIcons] = useState(false);return (<Page><Navbartitle="Tabbar"/><Tabbarlabels={isTabbarLabels}icons={isTabbarIcons}className="left-0 bottom-0 fixed"><TabbarLinkactive={activeTab === 'tab-1'}onClick={() => setActiveTab('tab-1')}icon={isTabbarIcons && (<Iconios={<EnvelopeFill className="w-7 h-7" />}material={<MdEmail className="w-6 h-6" />}/>)}label={isTabbarLabels && 'Tab 1'}/><TabbarLinkactive={activeTab === 'tab-2'}onClick={() => setActiveTab('tab-2')}icon={isTabbarIcons && (<Iconios={<Calendar className="w-7 h-7" />}material={<MdToday className="w-6 h-6" />}/>)}label={isTabbarLabels && 'Tab 2'}/><TabbarLinkactive={activeTab === 'tab-3'}onClick={() => setActiveTab('tab-3')}icon={isTabbarIcons && (<Iconios={<CloudUploadFill className="w-7 h-7" />}material={<MdFileUpload className="w-6 h-6" />}/>)}label={isTabbarLabels && 'Tab 3'}/></Tabbar><List strong inset><ListItemtitle="Tabbar Labels"after={<Togglechecked={isTabbarLabels}onChange={() => setIsTabbarLabels(!isTabbarLabels)}/>}/><ListItemtitle="Tabbar Icons"after={<Togglechecked={isTabbarIcons}onChange={() => setIsTabbarIcons(!isTabbarIcons)}/>}/></List>{activeTab === 'tab-1' && (<Block strong inset className="space-y-4"><p><b>Tab 1</b></p><p><span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliasaccusantium necessitatibus, nihil quas praesentium at quibusdamcupiditate possimus et repudiandae dolorum delectus quo, similiquevoluptatem magni explicabo adipisci magnam ratione!</span><span>Quod praesentium consequatur autem veritatis, magni aliasconsectetur ut quo, voluptatum earum in repellat! Id, autem! Minussuscipit, ad possimus non voluptatem aliquam praesentium earumcorrupti optio velit tenetur numquam?</span><span>Illo id ipsa natus quidem dignissimos odio dolore veniam,accusamus vel assumenda nulla aliquam amet distinctio! Debitisdeserunt, et, cum voluptate similique culpa assumenda inventore,facilis eveniet iure optio velit.</span><span>Maiores minus laborum placeat harum impedit, saepe veniam iustovoluptates delectus omnis consectetur tenetur ex ipsa errordebitis aspernatur amet et alias! Sit odit cum voluptas quae? Est,omnis eos?</span></p></Block>)}{activeTab === 'tab-2' && (<Block strong inset className="space-y-4"><p><b>Tab 2</b></p><p><span>Dicta beatae repudiandae ab pariatur mollitia praesentium fugaipsum adipisci, quia nam expedita, est dolore eveniet, dolorumobcaecati? Veniam repellendus mollitia sapiente minus saepevoluptatibus necessitatibus laboriosam incidunt nihil autem.</span><span>Officia pariatur qui, deleniti eum, et minus nisi aliquam nobishic provident quisquam quidem voluptatem eveniet ducimus. Commodiea dolorem, impedit eaque dolor, sint blanditiis magni accusantiumnatus reprehenderit minima?</span><span>Dicta reiciendis ut vitae laborum aut repellendus quasi beataenulla sapiente et. Quod distinctio velit, modi ipsamexercitationem iste quia eaque blanditiis neque rerum optio, nullatenetur pariatur ex officiis.</span><span>Consectetur accusamus delectus sit voluptatem at esse! Aperiamunde maxime est nemo dicta minus autem esse nobis quibusdam iusto,reprehenderit harum, perferendis quae. Ipsum sit fugit similiquerecusandae quas inventore?</span></p></Block>)}{activeTab === 'tab-3' && (<Block strong inset className="space-y-4"><p><b>Tab 3</b></p><p><span>Vero esse ab natus neque commodi aut quidem nobis. Unde, quamasperiores. A labore quod commodi autem explicabo distinctio saepeex amet iste recusandae porro consectetur, sed dolorum sapientevoluptatibus?</span><span>Commodi ipsum, voluptatem obcaecati voluptatibus illum hic aliquamveritatis modi natus unde, assumenda expedita, esse eum fugit?Saepe aliquam ipsam illum nihil facilis, laborum quia, eius eadolores molestias dicta.</span><span>Consequatur quam laudantium, magnam facere ducimus temporatemporibus omnis cupiditate obcaecati tempore? Odit qui a,voluptas eveniet similique, doloribus eum dolorum ad, enim eaitaque voluptates porro minima. Omnis, magnam.</span><span>Debitis, delectus! Eligendi excepturi rem veritatis, adexercitationem tempore eveniet voluptates aut labore harum doloremnemo repellendus accusantium quibusdam neque? Itaque iustoquisquam reprehenderit aperiam maiores dicta iure necessitatibusest.</span></p></Block>)}</Page>);}