1.0.14 • Published 3 years ago

@sakit-sa/react-master-detail v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@sakit-sa/react-master-detail

Simple, easy master-detail for React

NPM JavaScript Style Guide

Live Playground

For examples of the react-master-detail in action, go to https://abdilar.github.io/react-master-detail.

OR

To run that demo on your own computer:

Getting Started

Install

npm install @sakit-sa/react-master-detail

Usage

import React from 'react';

import MasterDetail from '@sakit-sa/react-master-detail';
import '@sakit-sa/react-master-detail/dist/index.css';

const App = () => (
  <MasterDetail>
    <div>
      <div>Master header</div>
      <div>Master body</div>
    </div>
    <div>
      <div>Detail header</div>
      <div>Detail body</div>
    </div>
  </MasterDetail>
);

Props

NameTypeDefaultDescription
adjustablebooleantrueBoolean value to control whether can adjust the master and the detail sections.
canClosebooleantrueBoolean value to control whether can close detail section.
centerAlignbooleantrueBoolean value to control whether can aligns master section in the center.
classNameobject{}Apply a className to the control
defaultMasterWidthnumber600pxSet initial width of master section.
detailMinWidthstring number object550pxSet minimum width of detail section.
directionstringltrIs the master-detail direction (right-to-left or left-to-right)
idstringmaster-detail-[randomNumber(10000)]The unique identifier for the component.
masterMinWidthstring number object400pxSet minimum width of master section.
masterWidthstring number object600pxSet width of master section.
noDetailbooleanfalseBoolean value to control whether to show details section (Affects showDetail property).
renderAdjustIconelement<i className="icon-align" />Custom adjust icon
renderCloseIconelement<i className="icon-close" />Custom close icon
showDetailbooleantrueBoolean value to control whether show detail section.
onClosefunction-Trigger when detail section closed.

className Token

align alignIcon detail detailBody detailHeader detailWrapper masterBody masterHeader masterWrapper wrapper

See examples for more information (go to https://abdilar.github.io/react-master-detail/?path=/story/theme--class-name)

masterWidth Token

TypeDescriptionexample
numberBased on pxmasterWidth={500}
stringEither based on percentage or based on pixelmasterWidth="30%" masterWidth="500px"
objectFor responsive modemasterWidth = { xxdt: "40%", xdt: "400px", dt: 300, mdt: 200 };

masterMinWidth Token

TypeDescriptionexample
numberBased on pxmasterMinWidth={500}
stringEither based on percentage or based on pixelmasterMinWidth="30%" masterWidth="500px"
objectFor responsive modemasterMinWidth = { xxdt: "40%", xdt: "400px", dt: 300, mdt: 200 };

detailMinWidth Token

TypeDescriptionexample
numberBased on pxdetailMinWidth={500}
stringEither based on percentage or based on pixeldetailMinWidth="30%" masterWidth="500px"
objectFor responsive modedetailMinWidth = { xxdt: "40%", xdt: "400px", dt: 300, mdt: 200 };

Responsive Mode Tips

xxdt: Affects device widths of 1920px and larger.
xdt: Affects device widths of 1600px and larger.
dt: Affects device widths of 1200px and larger.
mdt: Affects device widths of 960px and larger.

License

MIT © Saeed Abdilar

1.0.11

3 years ago

1.0.10

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.2

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago