@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
96 lines (95 loc) • 3.04 kB
TypeScript
import type { HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
import type { ButtonProps } from '../button/Button';
import type { IconIcon } from '../icon/Icon';
import type { ImgProps } from '../../elements/img/Img';
import type { SkeletonShow } from '../skeleton/Skeleton';
import type { SpacingProps } from '../../shared/types';
export type InfoCardProps = {
/**
* Used in combination with `src` to provide an alt attribute for the image element.
*/
alt?: ReactNode;
/**
* Centers the content. Defaults to `false`.
*/
centered?: boolean;
/**
* Sets the drop shadow of the info card. Defaults to `true`.
*/
dropShadow?: boolean;
/**
* Custom icon. Defaults to the `lightbulb` icon.
*/
icon?: IconIcon;
/**
* [Image properties](/uilib/elements/image) applied to the `img` element if the component is used to display an image.
*/
imgProps?: ImgProps;
/**
* If set to `true`, an overlaying skeleton with animation will be shown. Defaults to `false`.
*/
skeleton?: SkeletonShow;
/**
* Stretch the card to fill the container.
*/
stretch?: boolean;
/**
* Specifies the path to the image.
*/
src?: string;
/**
* The text content of the InfoCard, displayed/rendered in a paragraph. To fully customize the content, see `children` property.
*/
text?: ReactNode;
/**
* Can be used to add custom content, which is displayed/rendered between the `text` property and buttons.
*/
children?: ReactNode;
/**
* The title of the InfoCard.
*/
title?: ReactNode;
/**
* Will be called when user clicks the close button.
*/
onClose?: MouseEventHandler<HTMLButtonElement>;
/**
* The close button text.
*/
closeButtonText?: ReactNode;
/**
* Will be called when user clicks the accept button.
*/
onAccept?: MouseEventHandler<HTMLButtonElement>;
/**
* The accept button text.
*/
acceptButtonText?: ReactNode;
/**
* Props forwarded to the close button.
*/
closeButtonProps?: ButtonProps;
/**
* Deprecated. Use `closeButtonProps` instead.
* @deprecated Use `closeButtonProps` instead.
*/
closeButtonAttributes?: ButtonProps;
/**
* Props forwarded to the accept button.
*/
acceptButtonProps?: ButtonProps;
/**
* Deprecated. Use `acceptButtonProps` instead.
* @deprecated Use `acceptButtonProps` instead.
*/
acceptButtonAttributes?: ButtonProps;
};
export type InfoCardAllProps = InfoCardProps & Omit<HTMLAttributes<HTMLDivElement>, 'title'> & SpacingProps;
export declare const infoCardDefaultProps: {
centered: boolean;
dropShadow: boolean;
skeleton: boolean;
icon: (props?: import("../icon/Icon").IconSVGProps) => import("react/jsx-runtime").JSX.Element;
};
declare const InfoCard: (localProps: InfoCardAllProps) => import("react/jsx-runtime").JSX.Element;
export default InfoCard;