Code Monkey home page Code Monkey logo

browser-tabs's Introduction

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

browser-tabs's People

Contributors

rajaosama avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.