phtabs
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

React Chrome Tabs

Usage

  1. use hooks
import { useChromeTabs } from "react-chrome-tabs";

function Example() {
  const [tabs, setTabs] = useState([]);
  const { ChromeTabs, addTab, updateTab, removeTab } = useChromeTabs({
    onTabActivated: (tabId) => {
      console.log('active:', tabId);
    },
    onTabReorder: (tabId, fromIndex, toIndex) => {},
    onTabClosed: (tabId) => {
    },
  });
  return (
    <div>
      <ChromeTabs />
      <button
        onClick={() =>
          addTab({ id: `id-${Date.now()}`, title: `页签`, favicon: false })
        }
      >
        New tab
      </button>
    </div>
  );
}
  1. use component
import { Tabs } from 'react-chrome-tabs';
<Tabs tabs={tabs} onTabActivated={}>

Readme

Keywords

none

Package Sidebar

Install

npm i phtabs

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

65.3 kB

Total Files

18

Last publish

Collaborators

  • sergeparsehub