package.src.components.Alert.AlertActionCloseButton.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 { Button, ButtonVariant, ButtonProps } from '../Button';
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
import { AlertContext } from './AlertContext';
/** Renders a close button for a dismissable alert when this sub-component is passed into
* the alert's actionClose property.
*/
export interface AlertActionCloseButtonProps extends ButtonProps {
/** Accessible label for the close button */
'aria-label'?: string;
/** Additional classes added to the alert action close button. */
className?: string;
/** A callback for when the close button is clicked. */
onClose?: () => void;
/** Variant Label for the close button. */
variantLabel?: string;
}
export const AlertActionCloseButton: React.FunctionComponent = ({
className,
onClose = () => undefined as any,
'aria-label': ariaLabel = '',
variantLabel,
...props
}: AlertActionCloseButtonProps) => (
{({ title, variantLabel: alertVariantLabel }) => (
)}
);
AlertActionCloseButton.displayName = 'AlertActionCloseButton';