# API of `@koobiq/components/breadcrumbs`

Documented on [Breadcrumbs](https://koobiq.io/en/components/breadcrumbs.md). NgModule: `KbqBreadcrumbsModule`.

## Components

### KbqBreadcrumbItem (component)

Component represents an individual breadcrumb item with optional support for router navigation and styling.

```ts
@Component({ selector: 'kbq-breadcrumb-item' })
class KbqBreadcrumbItem {
    readonly text = input<string>('');
    readonly disabled = input<boolean>(false);
    readonly current = input<boolean>(false);
    readonly customTemplateRef: Signal<TemplateRef<unknown> | undefined>;
    readonly routerLink: RouterLink | null;
}
```

- `[text]`: `string` — The text displayed for the breadcrumb item.
  This text will be shown if breadcrumb item is hidden in dropdown.
- `[disabled]`: `boolean` — Indicates whether the breadcrumb item is disabled.
- `[current]`: `boolean` — Indicates whether the breadcrumb item is the current/active item, which the trail exposes as
  `aria-current="page"`. The last item of a trail is current regardless of this input.
- `customTemplateRef`: `Signal<TemplateRef<unknown> | undefined>` — A reference to a custom template provided for the breadcrumb item content.
  The template can be used to override the default appearance of the breadcrumb.
- `routerLink`: `RouterLink | null` — An optional `RouterLink` instance for navigating to a specific route.
  Injected from the host element, if available and projecting to the hidden breadcrumb item in dropdown.

### KbqBreadcrumbs (component)

```ts
@Component({ selector: 'kbq-breadcrumbs,[kbq-breadcrumbs]' })
class KbqBreadcrumbs {
    readonly ariaLabel = input<string | null>(null, {
        alias: 'aria-label'
    });
    readonly firstItemNegativeMargin = input<boolean>(
        this.configuration.firstItemNegativeMargin
    );
    readonly size = input<KbqDefaultSizes>(this.configuration.size);
    readonly max = input<number | null>(this.configuration.max);
    readonly disabled = input<boolean>(false);
    readonly wrapMode = input<KbqBreadcrumbsWrapMode>(
        this.configuration.wrapMode
    );
}
```

- `[aria-label]`: `string | null` — Accessible name of the navigation landmark. Set it whenever a page renders more than one trail, so
  assistive technology can tell them apart. Left unset, the name comes from the active locale.
- `[firstItemNegativeMargin]`: `boolean` — Determines if a negative margin should be applied to the first breadcrumb item. The default comes from
  `KbqBreadcrumbsConfiguration`.
- `[size]`: `KbqDefaultSizes` — Size of the breadcrumbs. Affects font size.
  Default value is taken from the global configuration.
- `[max]`: `number | null` — Maximum number of visible breadcrumb items.
  Remaining items are collapsed into a dropdown if the total exceeds this value.
  Default value is taken from the global configuration.
- `[disabled]`: `boolean` — Indicates whether the breadcrumbs are disabled.
  When disabled, every item and the expand button stop navigating and leave the tab order.
- `[wrapMode]`: `KbqBreadcrumbsWrapMode` — Wrapping behavior of the breadcrumb items.
- `[dir]`: `Direction | null` — Reading direction the arrow keys are mapped against, written onto the host as `dir`. Left unset,
  no attribute is emitted — the element inherits the document direction, and the key mapping follows
  the ambient CDK `Directionality`.
- `[loop]`: `boolean` — Whether the arrow keys wrap around, from the last item to the first and back.
- `[localeOverrides]`: `KbqPartialLocaleData | undefined` — Localized strings for this element and its subtree, keyed by locale section. Every key is optional at
  every depth.

## Directives

### KbqBreadcrumbButton (directive)

Directive to style and configure buttons used as breadcrumb items.
- Takes part in the roving focus of `KbqBreadcrumbs`: the arrow keys move between the items.
- Optionally injects `KbqButton` to customize its style for breadcrumb usage.
- Sets `type="button"` on a `<button>` host, so a breadcrumb never submits a surrounding form.

```ts
@Directive({ selector: '[kbq-button][kbqBreadcrumb]' })
class KbqBreadcrumbButton {}
```

- `[focusable]`: `boolean` — Whether the item takes part in the roving focus. The arrow keys skip an item that does not, and a click
  does not focus it.

### KbqBreadcrumbsSeparator (directive)

```ts
@Directive({ selector: 'ng-template[kbqBreadcrumbsSeparator]' })
class KbqBreadcrumbsSeparator {
    readonly templateRef: TemplateRef<unknown>;
}
```

### KbqBreadcrumbView (directive)

Directive provides a way to define a custom template for breadcrumb rendering, leveraging TemplateRef

```ts
@Directive({ selector: '[kbqBreadcrumbView]' })
class KbqBreadcrumbView {
    readonly templateRef: TemplateRef<unknown>;
}
```

## Types

### KbqBreadcrumbsConfiguration (type)

```ts
type KbqBreadcrumbsConfiguration = {
    max: number | null;
    size: KbqDefaultSizes;
    firstItemNegativeMargin: boolean;
    wrapMode: KbqBreadcrumbsWrapMode;
};
```

- `max`: `number | null` — Specifies the maximum number of breadcrumb items to display.
  - If a number is provided, only that many items will be shown.
  - If `null`, no limit is applied, and all breadcrumb items are displayed.
- `firstItemNegativeMargin`: `boolean` — Determines if a negative margin should be applied to the first breadcrumb item.
- `wrapMode`: `KbqBreadcrumbsWrapMode` — Manages breadcrumb items when space is limited:
  - `auto`: Adjusts based on space and item count.
  - `wrap`: Moves items to the next line if needed.
  - `none`: Prevents wrapping, allowing overflow.

### KbqBreadcrumbsWrapMode (type)

```ts
type KbqBreadcrumbsWrapMode = 'auto' | 'wrap' | 'none';
```

### KbqRovingFocusOrientation (type)

Axis a roving-focus group navigates along.

```ts
type KbqRovingFocusOrientation = 'horizontal' | 'vertical';
```

## Constants

### KBQ_BREADCRUMBS_CONFIGURATION (const)

Breadcrumbs options global configuration provider.

```ts
const KBQ_BREADCRUMBS_CONFIGURATION: InjectionToken<KbqBreadcrumbsConfiguration>;
```

### kbqBreadcrumbsConfigurationProvider (const)

Utility provider for `KBQ_BREADCRUMBS_CONFIGURATION`.

```ts
const kbqBreadcrumbsConfigurationProvider: (
    configuration: Partial<KbqBreadcrumbsConfiguration>
) => Provider;
```
