UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

105 lines (104 loc) 3.5 kB
import React from 'react'; import type { SectionBackgroundColor, SectionVariants } from '../section/Section'; import type { SpaceTypeAll, SpaceTypeMedia, SpacingProps } from '../../shared/types'; import type { SkeletonShow } from '../skeleton/Skeleton'; import type { BreadcrumbItemProps } from './BreadcrumbItem'; import BreadcrumbItem from './BreadcrumbItem'; export type BreadcrumbProps = { /** * Custom className on the component root * Default: `null` */ className?: string; /** * Skeleton should be applied when loading content * Default: `null` */ skeleton?: SkeletonShow; /** * Pass in a list of your pages as objects of breadcrumbitem to render them as breadcrumbitems. * Default: `null` */ data?: Array<BreadcrumbItemProps>; /** * The content of the component. Can be used instead of prop "data". * Default: `null` */ children?: React.ReactElement<BreadcrumbItemProps> | Array<React.ReactElement<BreadcrumbItemProps>>; /** * The variant of the component. * Defaults to `single` when children and data are not defined, `responsive` if they are. */ variant?: 'responsive' | 'single' | 'multiple' | 'collapse'; /** * Handle the click event on 'single'/'collapse' * Default: `null` */ onClick?: React.MouseEventHandler<HTMLButtonElement>; /** * For variant 'single', use href (or onClick) to set href when clicking "Back" * Default: `null` */ href?: string; /** * Every <nav> on a page needs an unique aria-label text * Default: `Page hierarchy` */ navText?: React.ReactNode; /** * Add custom 'Back' text for variant 'single' * Default: `'Back' or defined by Context translation` */ goBackText?: React.ReactNode; /** * Add custom 'Home' text * Default: `'Home' or defined by Context translation` */ homeText?: React.ReactNode; /** * Add custom 'Back to...' text, for variant collapse * Default 'Back to...' or defined by Context translation */ backToText?: React.ReactNode; /** * If variant='collapse', you can override collapsed state for the collapsed content by updating this value. * Default: `null` */ collapsed?: boolean; /** * Use one of the Section background colors. * Default: `transparent` */ backgroundColor?: SectionBackgroundColor; /** * Use one of the Section component variants * Default: `information` */ collapsedStyleType?: SectionVariants; /** * Include spacing properties in breadcrumb. If only `true` is given, the spacing will be `small`. * Default: `false` */ spacing?: SpaceTypeAll | SpaceTypeMedia; /** * Will disable the height animation * Default: `false` */ noAnimation?: boolean; /** * Will be called when breadcrumb expands or collapses. */ onToggle?: (collapsed: boolean) => void; /** * Send along a custom React Ref. * Default: `null` */ ref?: React.Ref<HTMLElement>; }; export type BreadcrumbAllProps = BreadcrumbProps & SpacingProps & Omit<React.HTMLProps<HTMLElement>, keyof BreadcrumbProps>; declare const Breadcrumb: { (localProps: BreadcrumbAllProps): import("react/jsx-runtime").JSX.Element; Item: (localProps: BreadcrumbItemProps) => import("react/jsx-runtime").JSX.Element; }; export { BreadcrumbItem }; export default Breadcrumb;