1.0.13 • Published 4 years ago

react-browser-tabs v1.0.13

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

react-browser-tabs 🖥

Browser like tabs for you custom browser, you can use this in Electron App. 🎉

react-browser-tab DEMO

when to use this ?

If one day you wake up 🌄 and decided to create your own browser 💻 with some javascript frameworks 🦾, this library will come in handy 🤟.

NPM JavaScript Style Guide

Install

npm install --save react-browser-tabs

Usage

import React, { useState } from 'react'

import MyComponent from 'react-browser-tabs'

const Example = () => {
  const defaultTabs = [
    {
      title: 'getting started',
      url: 'https://google.com/', // auto fetch url
      id: 'tab1',
      content: (props) => <span>Hello World</span>
    }
  ]
  const tabs = useState(defaultTabs)
  const activeTab = useState(0)

  return (
    <BrowserTabs
      onAddTabPress={addTab} // CallBack for a Tab Add
      theme={isDark ? Dark : Light} // Theming
      injectProps={{ isDark, setisDark }} // custom props that you needed it to be injected.
      activeTab={activeTab} // keep a track of active index via state.
      tabs={tabs} // tabs
    />
  )
}

Add Tabs

const addTab = () => {
  activeTab[1](tabs[0].length)
  tabs[1]([
    ...tabs[0],
    {
      title: 'New Tab ',
      url: 'https://rajaosama.me/',
      id: 'tab1',
      content: (props) => (
        <span style={{ color: props.isDark ? 'white' : 'black' }}>
          New Tab Opened
        </span>
      )
    }
  ])
}

it automatically get the favicon for your desire app, just pass the url as it is.

License

MIT © rajaosama

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago