package.src.components.Popover.PopoverHeader.tsx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react-core Show documentation
Show all versions of react-core Show documentation
This library provides a set of common React components for use with the PatternFly reference implementation.
The newest version!
import * as React from 'react';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/Popover/popover';
import { PopoverHeaderIcon } from './PopoverHeaderIcon';
import { PopoverHeaderText } from './PopoverHeaderText';
export interface PopoverHeaderProps extends Omit, 'size'> {
/** Content of the popover header. */
children: React.ReactNode;
/** Indicates the header contains an icon. */
icon?: React.ReactNode;
/** Class to be applied to the header. */
className?: string;
/** Heading level of the header title */
titleHeadingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
/** Severity variants for an alert popover. This modifies the color of the header to match the severity. */
alertSeverityVariant?: 'custom' | 'info' | 'warning' | 'success' | 'danger';
/** Id of the header */
id?: string;
/** Text announced by screen reader when alert severity variant is set to indicate severity level */
alertSeverityScreenReaderText?: string;
}
export const PopoverHeader: React.FunctionComponent = ({
children,
icon,
className,
titleHeadingLevel = 'h6',
alertSeverityVariant,
id,
alertSeverityScreenReaderText,
...props
}: PopoverHeaderProps) => (
{icon && {icon} }
{alertSeverityVariant && alertSeverityScreenReaderText && (
{alertSeverityScreenReaderText}
)}
{children}
);
PopoverHeader.displayName = 'PopoverHeader';