1
1
# react-browser-containers
2
2
3
- React Browser "container" components library , with tabs functionality. The library currency provides two browser components: ` ChromeBrowser ` and ` ArcBrowser ` .
3
+ Customizable browser-like containers , with tabs functionality (React) . The library currency provides two browser components: ` ChromeBrowser ` and ` ArcBrowser ` .
4
4
5
5
![ npm] ( https://img.shields.io/npm/v/@enhanced-jax/react-browser-containers )
6
6
![ GitHub license] ( https://img.shields.io/github/license/EnhancedJax/react-browser-containers )
@@ -20,45 +20,40 @@ import { useState } from "react";
20
20
21
21
const App = () => {
22
22
const [tab , setTab ] = useState (0 );
23
-
24
- return (
25
- < ChromeBrowser
26
- tab= {tab}
27
- setTab= {setTab}
28
- tabs= {{
29
- name: " Tab 1" ,
30
- link: " /tab1" ,
31
- content: < div> Tab 1 Content< / div> ,
32
- }}
33
- >< / ChromeBrowser>
34
- );
23
+ const tabs = [
24
+ {
25
+ name: " Google" ,
26
+ link: " https://google.com" ,
27
+ content: < div> Content< / div> ,
28
+ icon: (
29
+ < img
30
+ src= " https://google.com/favicon.ico"
31
+ style= {{ width: " 100%" , height: " 100%" }}
32
+ / >
33
+ ),
34
+ },
35
+ ];
36
+
37
+ return < ChromeBrowser tab= {tab} setTab= {setTab} tabs= {tabs}>< / ChromeBrowser> ;
35
38
};
36
39
```
37
40
38
41
### Props
39
42
40
- ``` js
41
- export type ChromeBrowserProps = {
42
- theme ?: "light " | "dark "; // theme of the browser, default is light. The light and dark theme of ArcBrowser is the same.
43
- tabs ?: Array <{ // pages in the browser
44
- name : string ;
45
- link : string ; // decorative link in the URL bar
46
- content : React .ReactNode ; // content of the page
47
- icon : React .ReactNode ; // icon of the page. use w/h 100%.
48
- // tip: get fav icon from any site using https://www.domain.com/favicon.ico
49
- }> ;
50
- shadow?: boolean; // shadow of the browser, default is true
51
- useContentSize?: boolean; // default is false: browser will be the size of it's parent element. true: browser will be the size of it's content
52
- contentScroll?: boolean; // if content inside the container should be scrollable, default is true
53
- leftIcons?: React .ReactNode ; // leave empty for default icons
54
- rightIcons?: React .ReactNode ; // leave empty for default icons
55
- lightTheme?: Theme; // changes the light theme of the browser
56
- darkTheme?: Theme; // changes the dark theme of the browser
57
- children?: React .ReactNode ; // content displayed over all pages
58
- tab?: number;
59
- setTab?: (tab : number ) => void ;
60
- };
61
- ```
43
+ | Name | Type | Description |
44
+ | -------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
45
+ | theme | ` "light" \| "dark" ` | Theme of the browser, default is light. The light and dark theme of ArcBrowser is the same. |
46
+ | tabs | ` Array<{name: string;link: string;content: React.ReactNode;icon: React.ReactNode;}> ` | Pages in the browser. |
47
+ | shadow | ` boolean ` | Shadow of the browser, default is true. |
48
+ | useContentSize | ` boolean ` | Default is false: browser will be the size of its parent element. True: browser will be the size of its content. |
49
+ | contentScroll | ` boolean ` | If content inside the container should be scrollable, default is true. |
50
+ | leftIcons | ` React.ReactNode ` | Leave empty for default icons. |
51
+ | rightIcons | ` React.ReactNode ` | Leave empty for default icons. |
52
+ | lightTheme | ` Theme ` | Changes the light theme of the browser. |
53
+ | darkTheme | ` Theme ` | Changes the dark theme of the browser. |
54
+ | children | ` React.ReactNode ` | Content displayed over all pages. |
55
+ | tab | ` number ` | Active tab index. |
56
+ | setTab | ` (tab: number) => void ` | Function to set the active tab index. |
62
57
63
58
``` js
64
59
export default interface Theme {
0 commit comments