Giter VIP home page Giter VIP logo

rc-dock's Introduction

Dock Layout for React Component

Popup panel as new browser window

Dark Theme

Usage

rc-tabs

import DockLayout from 'rc-dock'
import "rc-dock/dist/rc-dock.css";

...

defaultLayout = {
  dockbox: {
    mode: 'horizontal',
    children: [
      {
        tabs: [
          {id: 'tab1', title: 'tab1', content: <div>Hello World</div>}
        ]
      }
    ]
  }
};

render() {
  return (
    <DockLayout
      defaultLayout={defaultLayout}
      style={{
        position: "absolute",
        left: 10,
        top: 10,
        right: 10,
        bottom: 10,
      }}
    />
  )
}

types

LayoutData ๐Ÿ—Ž

Property Type Comments Default
dockbox BoxData main dock box empty BoxData
floatbox BoxData main float box, children can only be PanelData empty BoxData

BoxData ๐Ÿ—Ž

a box is the layout element that contains other boxes or panels

Property Type Comments Default
mode 'horizontal' | 'vertical' | 'float' layout mode of the box
children (BoxData | PanelData)[] children boxes or panels required

PanelData ๐Ÿ—Ž

a panel is a visiaul container with tabs button in the title bar

Property Type Comments Default
tabs TabData[] children tabs required
panelLock PanelLock addition information of a panel, this prevents the panel from being removed when there is no tab inside, a locked panel can not be moved to float layer either

TabData ๐Ÿ—Ž

Property Type Comments Default
id string unique id required
title string | ReactElement tab title required
content ReactElement | (tab: TabData) => ReactElement tab content required
closable bool whether tab can be closed false
group string tabs with different tab group can not be put in same panel, more options for the group can be defined as TabGroup in DefaultLayout.groups

DockLayout API

get the ref of the DockLayout component to use the following API

saveLayout ๐Ÿ—Ž

save layout

saveLayout(): SavedLayout 

loadLayout ๐Ÿ—Ž

load layout

 loadLayout(savedLayout: SavedLayout): void

dockMove ๐Ÿ—Ž

move a tab or a panel, if source is already in the layout, you can use the find method to get it with id first

dockMove(source: TabData | PanelData, target: string | TabData | PanelData | BoxData, direction: DropDirection): void;

find PanelData or TabData by id

find(id: string): PanelData | TabData;

updateTab ๐Ÿ—Ž

update a tab with new TabData

returns false if the tab is not found

updateTab(id: string, newTab: TabData): boolean;

rc-dock's People

Contributors

rinick avatar dependabot-preview[bot] avatar slavamuravey avatar dependabot[bot] avatar asheshv avatar afdw avatar chris-kruining avatar craigmit avatar jsrilapan avatar matej-mnoucek-adsk avatar aircloud avatar ivmi avatar md5pk 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.