Debian Codegraph @

node/@patternfly/react-core/src/components/Modal/ModalBody.tsx

raw
1 import { css } from '@patternfly/react-styles';
2 import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
3
4 /** Renders content in the body of the modal */
5
6 export interface ModalBodyProps extends React.HTMLProps<HTMLDivElement> {
7 /** Content rendered inside the modal body. */
8 children?: React.ReactNode;
9 /** Additional classes added to the modal body. */
10 className?: string;
11 /** Accessible label applied to the modal body. This should be used to communicate
12 * important information about the modal body div element if needed, such as when it is scrollable.
13 */
14 'aria-label'?: string;
15 /** Accessible role applied to the modal body. This will default to "region" if the
16 * aria-label property is passed in. Set to a more appropriate role as applicable
17 * based on the modal content and context.
18 */
19 role?: string;
20 }
21
22 export const ModalBody: React.FunctionComponent<ModalBodyProps> = ({
23 children,
24 className,
25 'aria-label': ariaLabel,
26 role,
27 ...props
28 }: ModalBodyProps) => {
29 const defaultModalBodyRole = ariaLabel ? 'region' : undefined;
30 return (
31 <div
32 aria-label={ariaLabel}
33 role={role || defaultModalBodyRole}
34 className={css(styles.modalBoxBody, className)}
35 {...props}
36 >
37 {children}
38 </div>
39 );
40 };
41 ModalBody.displayName = 'ModalBody';