GithubHelp home page GithubHelp logo

enhancedjax / react-browser-components Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1002 KB

Customizable browser-like frames, with tabs functionality (React).

Home Page: https://react-browser-containers.jaxtam.dev

License: MIT License

Shell 0.20% TypeScript 99.80%
react reactcomponents reactjs reactlibrary storybook

react-browser-components's Introduction

๐ŸชŸ react-browser-components โœจ

React component for browser-windows like containers, with tabs functionality.

npm i react-browser-components

npm GitHub license npm bundle size

ChromeBrowser ArcBrowser

You can use the components to demonstrate functionality with browsers, or as decorative elements in your project. The components are not designed to be used as actual browsers.

Basic Usage

import { ChromeBrowser, ArcBrowser } from "react-browser-components";
import { useState } from "react";

const App = () => {
  const [tab, setTab] = useState(0);
  const tabs = [
    {
      name: "Google",
      link: "https://google.com",
      content: <div>Content</div>,
      icon: (
        <img
          src="https://google.com/favicon.ico"
          style={{ width: "100%", height: "100%" }}
        />
      ),
    },
  ];

  return (
    <>
      <ChromeBrowser tabs={tabs} tab={tab} setTab={setTab} />
      <ArcBrowser tabs={tabs} tab={tab} setTab={setTab} />
    </>
  );
};

Props

Name Type Description
theme "light" | "dark" Theme of the browser, default is light. The light and dark theme of ArcBrowser is the same.
tabs Array<{name: string;link: string;content: React.ReactNode;icon: React.ReactNode;}> Pages in the browser.
shadow boolean Shadow of the browser, default is true.
useContentSize boolean Default is false: browser will be the size of its parent element. True: browser will be the size of its content.
contentScroll boolean If content inside the container should be scrollable, default is true.
leftIcons React.ReactNode Leave empty for default icons.
rightIcons React.ReactNode Leave empty for default icons.
lightTheme Theme Changes the light theme of the browser.
darkTheme Theme Changes the dark theme of the browser.
children React.ReactNode Content displayed over all pages.
tab number Active tab index.
setTab (tab: number) => void Function to set the active tab index.
export default interface Theme {
  theme: string;
  bg: string;
  text: string;
  contentBg: string;
  contentText: string;
  border: string;
  searchBarBg: string;
  tabBarBg: string;
  tabDivider: string;
  tabHoverBg: string;
  tabSelectedBg: string;
}

Development

To get started:

git clone https://github.com/EnhancedJax/react-browser-components.git
cd react-browser-components
npm i

Actions:

npm run storybook # start storybook
npm run build # build the library
npm run test # test the library

Testing in another project

npm run build
npm link
npm link "../your-project/node_modules/react"
cd ../your-project
npm link react-browser-components

react-browser-components's People

Contributors

enhancedjax avatar

Stargazers

 avatar  avatar

Watchers

 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.