reactstrap#NavItem TypeScript Examples

The following examples show how to use reactstrap#NavItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TabItem.tsx    From opensaas with MIT License 6 votes vote down vote up
TabItem: React.FC<TabItemProps> = (props) => {
  const { activeClass = '', activeTab, tabId, toggle, children, className = '' } = props;
  const isActive = activeTab === tabId;
  const NavItemContent = activeClass ? 'div' : NavLink;
  return (
    <NavItem className={classNames({ 'border-0 m-0 p-0 bg-white': activeClass })}>
      <NavItemContent
        className={classNames(className, 'cursor-pointer', { active: isActive, [activeClass]: isActive })}
        onClick={() => toggle(tabId)}>
        {children}
      </NavItemContent>
    </NavItem>
  );
}
Example #2
Source File: Tabs.tsx    From nextclade with MIT License 6 votes vote down vote up
export function TabComponent({ tab, activeTab, onChange, disabled, ...props }: TabComponentProps) {
  const onClick = useCallback(() => {
    if (activeTab !== tab.name) {
      onChange(tab.name)
    }
  }, [activeTab, onChange, tab.name])

  return (
    <NavItem>
      <NavLink active={!disabled && activeTab === tab.name} onClick={onClick} disabled={disabled} {...props}>
        {tab.title}
      </NavLink>
    </NavItem>
  )
}