diff --git a/components/doc/common/docsectioncode.js b/components/doc/common/docsectioncode.js index 9f238dde9b..09d27593c5 100644 --- a/components/doc/common/docsectioncode.js +++ b/components/doc/common/docsectioncode.js @@ -77,7 +77,7 @@ export function DocSectionCode(props) { )} {codeMode !== 'basic' && codeLang === 'typescript' && (
Name | +Type | +Default | +Description | +
---|---|---|---|
id | +string | +null | +Unique identifier of the element. | +
dismissable | +boolean | +true | +Enables to hide the overlay when outside is clicked. | +
showCloseIcon | +boolean | +false | +When enabled, displays a close icon at top right corner. | +
style | +string | +null | +Inline style of the element. | +
className | +string | +null | +Style class of the element. | +
appendTo | +DOM element | string | +document.body | ++ DOM element instance where the overlay panel should be mounted. Valid values are any DOM Element and 'self'. The self value is used to render a component where it is located. + | +
ariaCloseLabel | +string | +close | +Aria label of the close icon. | +
breakpoints | +object | +null | +Object literal to define widths per screen size. | +
transitionOptions | +object | +null | ++ The properties of{' '} + + CSSTransition + {' '} + can be customized, except for "nodeRef" and "in" properties. + | +
Name | +Parameters | +Description | +
---|---|---|
onShow | +- | +Callback to invoke when overlay becomes visible. | +
onHide | +- | +Callback to invoke when overlay becomes hidden. | +
Name | +Parameters | +Description | +
---|---|---|
toggle | +event: Browser event | +Toggles the visiblity of the overlay. | +
show | +
+ event: Browser event + target: Optional target if event.target should not be used + |
+ Shows the overlay. | +
hide | +- | +Hides the overlay. | +
+ Following is the list of structural style classes, for theming classes visit theming page. +
+Name | +Element | +
---|---|
p-overlaypanel | +Container element. | +
p-overlaypanel-content | +Content of the panel. | +
p-overlaypanel-close | +Close icon. | +
+ OverlayPanel component uses dialog role and since any attribute is passed to the root element you may define attributes like aria-label or aria-labelledby to describe the popup contents. In addition{' '} + aria-modal is added since focus is kept within the popup. +
++ It is recommended to use a trigger component that can be accessed with keyboard such as a button, if not adding tabIndex would be necessary. OverlayPanel adds aria-expanded state attribute and aria-controls to + the trigger so that the relation between the trigger and the popup is defined. +
+ ++ When the popup gets opened, the first focusable element receives the focus and this can be customized by adding autofocus to an element within the popup. +
+ +Key | +Function | +
---|---|
+ tab + | +Moves focus to the next the focusable element within the popup. | +
+ shift + tab + | +Moves focus to the previous the focusable element within the popup. | +
+ escape + | +Closes the popup and moves focus to the trigger. | +
Key | +Function | +
---|---|
+ enter + | +Closes the popup and moves focus to the trigger. | +
+ space + | +Closes the popup and moves focus to the trigger. | +
None.
+ > + ); +} diff --git a/components/doc/overlaypanel/importdoc.js b/components/doc/overlaypanel/importdoc.js new file mode 100644 index 0000000000..5187b14ac1 --- /dev/null +++ b/components/doc/overlaypanel/importdoc.js @@ -0,0 +1,17 @@ +import { DocSectionText } from '../common/docsectiontext'; +import { DocSectionCode } from '../common/docsectioncode'; + +export function ImportDoc(props) { + const code = { + basic: ` +import { OverlayPanel } from 'primereact/overlaypanel'; + ` + }; + + return ( + <> +OverlayPanel is accessed via its reference where visibility is controlled using toggle, show and hide methods.
-Clicking outside the overlay hides the panel, setting dismissable to false disables this behavior. Additionally enablign showCloseIcon property displays a close icon at the top right corner to close the panel.
- -- OverlayPanel width can be adjusted per screen size with the breakpoints option. In example below, default width is set to 450px and below 961px, width would be 75vw and finally below 641px width becomes 100%. The value - of breakpoints should be an object literal whose keys are the maximum screen sizes and values are the widths per screen. -
- -Name | -Type | -Default | -Description | -
---|---|---|---|
id | -string | -null | -Unique identifier of the element. | -
dismissable | -boolean | -true | -Enables to hide the overlay when outside is clicked. | -
showCloseIcon | -boolean | -false | -When enabled, displays a close icon at top right corner. | -
style | -string | -null | -Inline style of the element. | -
className | -string | -null | -Style class of the element. | -
appendTo | -DOM element | string | -document.body | -- DOM element instance where the overlay panel should be mounted. Valid values are any DOM Element and 'self'. The self value is used to render a component where it is located. - | -
ariaCloseLabel | -string | -close | -Aria label of the close icon. | -
breakpoints | -object | -null | -Object literal to define widths per screen size. | -
transitionOptions | -object | -null | -- The properties of{' '} - - CSSTransition - {' '} - can be customized, except for "nodeRef" and "in" properties. - | -
Name | -Parameters | -Description | -
---|---|---|
onShow | -- | -Callback to invoke when overlay becomes visible. | -
onHide | -- | -Callback to invoke when overlay becomes hidden. | -
Name | -Parameters | -Description | -
---|---|---|
toggle | -event: Browser event | -Toggles the visiblity of the overlay. | -
show | -
- event: Browser event - target: Optional target if event.target should not be used - |
- Shows the overlay. | -
hide | -- | -Hides the overlay. | -
- Following is the list of structural style classes, for theming classes visit theming page. -
-Name | -Element | -
---|---|
p-overlaypanel | -Container element. | -
p-overlaypanel-content | -Content of the panel. | -
p-overlaypanel-close | -Close icon. | -
- OverlayPanel component uses dialog role and since any attribute is passed to the root element you may define attributes like aria-label or aria-labelledby to describe the popup contents. In addition{' '} - aria-modal is added since focus is kept within the popup. -
-- It is recommended to use a trigger component that can be accessed with keyboard such as a button, if not adding tabIndex would be necessary. OverlayPanel adds aria-expanded state attribute and{' '} - aria-controls to the trigger so that the relation between the trigger and the popup is defined. -
- -- When the popup gets opened, the first focusable element receives the focus and this can be customized by adding autofocus to an element within the popup. -
- -Key | -Function | -
---|---|
- tab - | -Moves focus to the next the focusable element within the popup. | -
- shift + tab - | -Moves focus to the previous the focusable element within the popup. | -
- escape - | -Closes the popup and moves focus to the trigger. | -
Key | -Function | -
---|---|
- enter - | -Closes the popup and moves focus to the trigger. | -
- space - | -Closes the popup and moves focus to the trigger. | -
None.
-