5.0.0 • Published 4 years ago

@normanandsons/react-responsive-tab-pills v5.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

react-responsive-tab-pills

Description

Navbar component that moves the navbar items to a dropdown, if they do not fit in the content area.

Installation

npm install @normanandsons/react-responsive-tab-pills

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

Prop nameTypeDefaultDescription
idstring'responsive-navbar'Custom ID prefix
classNamestringCuston className
activeKeynumberobjectrequiredNavbar item to be active initially
listarray of object (name, href)requiredList of navbar items
fontSizestring'inherit'override for fontSize
fontWeightstring'inherit'override for fontWeight
heightstring40pxoverride for height
heightstring40pxoverride for height
onSelectfunctionCallback fired when the active item changes
allowReorderbooleanAllow drag and drop reorder
onReorderfunctionCallback fired when pills rearranged
allowClosebooleanAllow pills to be closable
onClosefunctionCallback fired when pills closed

Code example

import ResponsiveTabPills from '@normanandsons/react-responsive-tab-pills';

const ResponsiveNavbarView = (props) => {
  const list = [
    { name: 'Item 1', id: 0, href: '/settings' },
    { name: 'Item 2', id: 1, href: '/help' },
  ];

  const activeKey = 1;

  return (
    <ResponsiveTabPills
      activeKey={activeKey}
      list={list}
      onSelect={(id, index) => { props.router.push(list[index].href); }}
    />
  );
};

export default withRouter(ResponsiveNavbarView);
5.0.0

4 years ago

4.1.0

4 years ago

4.0.0

4 years ago