# @salmonui/navigation/breadcrumbs API reference

> 9 exported symbols of @salmonui/navigation/breadcrumbs: 2 functions, 4 interfaces, 2 types and 1 constant.

Canonical: https://salmonui.dev/docs/reference/navigation/breadcrumbs

```ts
import { … } from '@salmonui/navigation/breadcrumbs';
```

## Functions

### BreadcrumbItem

Kind: function

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BreadcrumbItem

```ts
function BreadcrumbItem(props: BreadcrumbItemProps): ReactElement;
```

One step of the trail: a link (`href`), or text (no `href`, the current
item unless `currentNavigable`, or `disabled`). Must be a child of
`Breadcrumbs`.

### Breadcrumbs

Kind: function

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/Breadcrumbs

```ts
function Breadcrumbs(props: BreadcrumbsProps): ReactElement;
```

APG Breadcrumb trail. Styling hooks: `.salmon-breadcrumbs` with
`data-overflow`, `data-disabled`, `data-separator`; `.salmon-breadcrumbs-list`,
`.salmon-breadcrumbs-item` (`data-current`, `data-disabled`),
`.salmon-breadcrumbs-link`, `.salmon-breadcrumbs-text`,
`.salmon-breadcrumbs-ellipsis`.

## Interfaces

### BreadcrumbItemProps

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BreadcrumbItemProps

```ts
interface BreadcrumbItemProps {
    readonly children?: ReactNode;
    readonly href?: string | undefined;
    readonly target?: string | undefined;
    readonly rel?: string | undefined;
    readonly icon?: ReactNode;
    readonly disabled?: boolean | undefined;
    readonly current?: boolean | undefined;
    readonly render?: ((props: BreadcrumbItemRenderProps) => ReactElement) | undefined;
    readonly onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly id?: string | undefined;
    readonly title?: string | undefined;
}
```

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | The item's label. |
| `href` | `readonly href?: string \| undefined;` | optional | Link target. Without `href` the item renders as text. |
| `target` | `readonly target?: string \| undefined;` | optional |  |
| `rel` | `readonly rel?: string \| undefined;` | optional |  |
| `icon` | `readonly icon?: ReactNode;` | optional | Decorative icon before the label (`aria-hidden`). |
| `disabled` | `readonly disabled?: boolean \| undefined;` | optional | Not interactive: text with `aria-disabled="true"`. |
| `current` | `readonly current?: boolean \| undefined;` | optional | The current page (`aria-current="page"`). Default: the last item. |
| `render` | `readonly render?: ((props: BreadcrumbItemRenderProps) => ReactElement) \| undefined;` | optional | Renders another element for the link (a router link): `render={(props) => <Link {...props} to="/x" />}`. |
| `onClick` | `readonly onClick?: ((event: MouseEvent<HTMLElement>) => void) \| undefined;` | optional |  |
| `className` | `readonly className?: string \| undefined;` | optional | On the `<li>`. |
| `style` | `readonly style?: CSSProperties \| undefined;` | optional | On the `<li>`. |
| `id` | `readonly id?: string \| undefined;` | optional | On the `<li>`. |
| `title` | `readonly title?: string \| undefined;` | optional |  |

### BreadcrumbsItemClickEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BreadcrumbsItemClickEvent

```ts
interface BreadcrumbsItemClickEvent {
    readonly index: number;
    readonly item: BreadcrumbItemProps;
    readonly href: string | undefined;
    readonly source: PressSource;
    readonly menu: boolean;
    readonly defaultPrevented: boolean;
    preventDefault(): void;
}
```

`onItemClick` event. `preventDefault()` cancels the link's navigation.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `index` | `readonly index: number;` |  | Position of the item among the `BreadcrumbItem` children. |
| `item` | `readonly item: BreadcrumbItemProps;` |  | The clicked item's props. |
| `href` | `readonly href: string \| undefined;` |  |  |
| `source` | `readonly source: PressSource;` |  |  |
| `menu` | `readonly menu: boolean;` |  | The item was chosen in the ellipsis menu. |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |
| `preventDefault` | `preventDefault(): void;` |  |  |

### BreadcrumbsLocaleText

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BreadcrumbsLocaleText

```ts
interface BreadcrumbsLocaleText {
    readonly label: string;
    readonly ellipsis: string;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `readonly label: string;` |  | Accessible name of the `<nav>` landmark. |
| `ellipsis` | `readonly ellipsis: string;` |  | Accessible name of the ellipsis button. |

### BreadcrumbsProps

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BreadcrumbsProps

```ts
interface BreadcrumbsProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
    readonly children?: ReactNode;
    readonly overflow?: BreadcrumbsOverflow | undefined;
    readonly maxItems?: number | undefined;
    readonly separator?: ReactNode;
    readonly currentNavigable?: boolean | undefined;
    readonly disabled?: boolean | undefined;
    readonly onItemClick?: ((event: BreadcrumbsItemClickEvent) => void) | undefined;
    readonly localeText?: Partial<BreadcrumbsLocaleText> | undefined;
    readonly ref?: Ref<HTMLElement> | undefined;
}
```

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | `BreadcrumbItem` elements (fragments and arrays are flattened). |
| `overflow` | `readonly overflow?: BreadcrumbsOverflow \| undefined;` | optional | Default `'menu'`. |
| `maxItems` | `readonly maxItems?: number \| undefined;` | optional | `'menu'` / `'expand'`: keep the first item and the last `maxItems - 1` items; the rest collapse behind the ellipsis. |
| `separator` | `readonly separator?: ReactNode;` | optional | Separator between items. Default a CSS chevron (mirrored in RTL). |
| `currentNavigable` | `readonly currentNavigable?: boolean \| undefined;` | optional | The current item renders as a link (when it has `href`) instead of text. |
| `disabled` | `readonly disabled?: boolean \| undefined;` | optional | Disables every item and the ellipsis. |
| `onItemClick` | `readonly onItemClick?: ((event: BreadcrumbsItemClickEvent) => void) \| undefined;` | optional | A link item was activated (in the list or the ellipsis menu); `preventDefault()` cancels navigation. |
| `localeText` | `readonly localeText?: Partial<BreadcrumbsLocaleText> \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLElement> \| undefined;` | optional | The `<nav>`. |

## Types

### BreadcrumbItemRenderProps

Kind: type

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BreadcrumbItemRenderProps

```ts
type BreadcrumbItemRenderProps = AnchorHTMLAttributes<HTMLElement> & {
    ref?: Ref<never> | undefined;
    [dataAttribute: `data-${string}`]: string | number | undefined;
};
```

Props a `BreadcrumbItem` `render` function receives: spread them all onto the returned element.

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `ref` | `ref?: Ref<never>;` | optional, inherited |  |

### BreadcrumbsOverflow

Kind: type

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BreadcrumbsOverflow

```ts
type BreadcrumbsOverflow = 'menu' | 'expand' | 'wrap' | 'scroll' | 'none';
```

## Constants

### BREADCRUMBS_DEFAULT_LOCALE_TEXT

Kind: const

Page: https://salmonui.dev/docs/reference/navigation/breadcrumbs/BREADCRUMBS_DEFAULT_LOCALE_TEXT

```ts
const BREADCRUMBS_DEFAULT_LOCALE_TEXT: BreadcrumbsLocaleText;
```
