@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
60 lines (59 loc) • 1.47 kB
TypeScript
import React from "react";
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
/**
* Alert content.
*/
children: React.ReactNode;
/**
* Level of severity. Changes colors and icon.
*/
variant: "error" | "warning" | "info" | "success";
/**
* Changes padding and font-sizes.
* @default "medium"
*/
size?: "medium" | "small";
/**
* Removes `border-radius`.
* @default false
*/
fullWidth?: boolean;
/**
* Sets max-width on the content to 43.5rem.
* @default true
*/
contentMaxWidth?: boolean;
/**
* Removes background, border and padding.
* @default false
*/
inline?: boolean;
/**
* Adds a close-button (X).
*
* **Requires onClose to be set**.
* @default false
*/
closeButton?: boolean;
/**
* Callback for alert wanting to close.
*
* **Requires closeButton to be true**.
*/
onClose?: () => void;
/**
* Overriding Alert color is not supported.
*/
"data-color"?: never;
}
/**
* A component for displaying alerts
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/alert)
* @see 🏷️ {@link AlertProps}
* @example
* ```jsx
* <Alert variant="error">Dette er en feilmelding</Alert>
* ```
*/
export declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
export default Alert;