5.0.1 • Published 2 years ago

@paprika/panel v5.0.1

Weekly downloads
1,287
License
MIT
Repository
github
Last release
2 years ago

@paprika/panel

Description

The Panel component provides a view that slides in from one side so the user can maintain context of their main task while they work on a sub task.

Installation

yarn add @paprika/panel

or with npm:

npm install @paprika/panel

Props

Panel

PropTyperequireddefaultDescription
a11yTextstringfalsenull
childrennodetrue-The content for the Panel.
containercustomfalsenullPortal container for the Panel (DOM element)
getPushContentElementfuncfalsenullFunction that provides the container DOM element to be pushed.
groupOffsetYnumberfalse0Y offset that is passed down from <Panel.Group>
heightstring,numberfalse"33%"The height of the open Panel (when slide in from bottom)
size Panel.types.sizes.MEDIUM, Panel.types.sizes.LARGEfalsePanel.types.sizes.MEDIUMControl the size of the Panel
isInlineboolfalsefalseRender the panel inline
isOpenboolfalsefalseControl the visibility of the Panel. This prop makes the Panel appear.
offsetshapefalse{ top: 0, left: 0, right: 0 }Control offset of the Panel. Only use 'top' when sliding in from the left or right. Only use 'left' or 'right' when sliding in from the bottom.
onAfterClosefuncfalse() => {}Callback once the Panel has been closed event
onAfterOpenfuncfalse() => {}Callback once the Panel has been opened event
onClosefuncfalsenullCallback triggered when the Panel needs to be close
slideFrom Panel.types.slideFroms.RIGHT, Panel.types.slideFroms.LEFT, Panel.types.slideFroms.BOTTOMfalsePanel.types.slideFroms.RIGHTControl where the Panel slides in from
widthstring,number,custom,custom,customfalse"33%"The width of the open Panel (when slide in from left or right)
zIndexnumberfalsezValue(7)Control the z-index of the Panel
hasAccentboolfalsefalseDifferentiate between similar coloured UI elements

Panel.Header

PropTyperequireddefaultDescription
childrennodetrue-
getPushContentElementfuncfalse() => {}
hasAccentboolfalsefalse
hasCloseButtonboolfalsetrue
isCloseButtonSemanticboolfalsetrue
isHeaderStickyboolfalsefalse
onClosefuncfalse() => {}

Panel.Content

PropTyperequireddefaultDescription
childrennodefalsenullBody content of the Content

Panel.Footer

PropTyperequireddefaultDescription
childrennodetrue-
isStickyboolfalsefalse

Panel.Overlay

PropTyperequireddefaultDescription
backdropClassNamestringfalse-
childrenfuncfalse-
containernodefalse-container of the Overlay element
focusLockOptionsshapefalse-
hasBackdropboolfalse-
isOpenboolfalse-
onClosefuncfalse-
onAfterOpenfuncfalse-
onAfterClosefuncfalse-
zIndexnumberfalse-The z-index of the Panel Overlay

Panel.Trigger

PropTyperequireddefaultDescription
childrennodetrue-

Components

You can use any of the following components to compose the Panel:

<Panel.Content />
<Panel.Header />
<Panel.Footer />
<Panel.Overlay />
<Panel.FocusLock />
<Panel.Trigger />

Basic examples

import Panel from "@paprika/panel";

const [isOpen, setIsOpen] = React.useState(true);

<Panel isOpen={isOpen} onClose={() => setIsOpen(false)} slideFrom={Panel.types.slideFrom.LEFT}>
  <Panel.Header>Header</Panel.Header>
  <Panel.Content>Your content here</Panel.Content>
  <Panel.Footer>
    <button>Accept</button>
    <button>Cancel</button>
  </Panel.Footer>
</Panel>;

FocusLock

There are issues when using FocusLock without the <Panel.Overlay />. Therefore the Panel will not use the focus lock when there is no overlay present. Focus locking will only be used when overlay is used to prevent this issue.

Warnings

If the content you are putting into this component will try and control focus (like CKEditor), read this: https://github.com/acl-services/paprika/issues/453

Links

5.0.1

2 years ago

5.0.1-next.0

2 years ago

5.0.0

2 years ago

5.0.0-next.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.0-next.0

2 years ago

4.0.1-next.0

2 years ago

3.0.4-next.0

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.3-next.0

3 years ago

3.0.2-next.0

3 years ago

3.0.0-next.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

3.0.1-next.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.4.2

3 years ago

2.4.2-next.0

3 years ago

2.4.1-next.0

3 years ago

2.4.1-next.1

3 years ago

2.4.0-next.1

3 years ago

2.3.2-next.0

3 years ago

2.3.1-next.1

3 years ago

2.3.1-next.0

3 years ago

2.3.1-next.2

3 years ago

2.3.1

3 years ago

2.2.4

4 years ago

2.3.0

4 years ago

2.3.0-next.1

4 years ago

2.3.0-next.0

4 years ago

2.2.3-next.0

4 years ago

2.2.3-next.1

4 years ago

2.2.1-next.0

4 years ago

2.2.1

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.2-next.1

4 years ago

2.2.2-next.0

4 years ago

2.2.2-next.3

4 years ago

2.2.2-next.2

4 years ago

2.2.4-next.0

4 years ago

2.2.0

4 years ago

2.1.10-next.0

4 years ago

2.1.9-next.0

4 years ago

2.1.9

4 years ago

2.2.0-next.1

4 years ago

2.1.8

4 years ago

2.1.7-next.0

4 years ago

2.1.8-next.0

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.6-next.0

4 years ago

2.1.5

4 years ago

2.1.5-next.0

4 years ago

2.1.4-next.0

4 years ago

2.1.4

4 years ago

2.1.3-next.0

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.2-next.0

4 years ago

2.1.1

4 years ago

2.1.1-next.0

4 years ago

2.0.12-next.0

4 years ago

2.0.11-next.0

4 years ago

2.0.11

4 years ago

2.1.0

4 years ago

2.1.0-next.1

4 years ago

2.0.9-next.1

4 years ago

2.0.10-next.0

4 years ago

2.0.9-next.0

4 years ago

2.0.9

4 years ago

2.0.10

4 years ago

2.0.8-next.0

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.7-alpha.4

4 years ago

2.0.7-alpha.3

4 years ago

2.0.7-alpha.2

4 years ago

2.0.7-alpha.1

4 years ago

2.0.7-alpha.0

4 years ago

2.0.6

4 years ago

2.0.6-alpha.0

4 years ago

2.0.5

4 years ago

2.0.5-alpha.0

4 years ago

2.0.4

4 years ago

2.0.4-alpha.0

4 years ago

2.0.3

5 years ago

2.0.3-alpha.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.1-alpha.1

5 years ago

2.0.1-alpha.0

5 years ago

2.0.0

5 years ago

1.0.4-alpha.3

5 years ago

1.0.4-alpha.2

5 years ago

1.0.4-alpha.1

5 years ago

1.0.4-alpha.0

5 years ago

1.0.3-alpha.1

5 years ago

1.0.3

5 years ago

1.0.3-alpha.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.1-alpha.0

5 years ago