# API of `@koobiq/components/overflow-items`

Documented on [Overflow items](https://koobiq.io/en/components/overflow-items.md). NgModule: `KbqOverflowItemsModule`.

## Directives

### KbqOverflowItem (directive)

Directive for the item that can be hidden by the `KbqOverflowItems` directive.

```ts
@Directive({ selector: '[kbqOverflowItem]', exportAs: 'kbqOverflowItem' })
class KbqOverflowItem extends ElementVisibilityManager {
    readonly id = input.required<unknown>({ alias: 'kbqOverflowItem' });
    readonly order = input<number | null>(null);
    readonly alwaysVisible = input<boolean>(false);
}
```

- `[kbqOverflowItem]`: `unknown` — Unique identifier for the item.
- `[order]`: `number | null` — Defines the order in which the item is processed in the overflow container,
  without changing its original position in the `QueryList`.
- `[alwaysVisible]`: `boolean` — Element with this attribute will be ignored when hiding and will always remain visible. Defaults to `false`.

### KbqOverflowItems (directive)

Directive for managing the visibility of items that overflow the container.

```ts
@Directive({ selector: '[kbqOverflowItems]', exportAs: 'kbqOverflowItems' })
class KbqOverflowItems {
    readonly reverseOverflowOrder = input<boolean>(false);
    readonly debounceTime = input<number>(0);
    readonly additionalResizeObserverTargets = input<Element | Element[]>(
        this.document.body
    );
    readonly orientation = input<KbqOrientation>('horizontal');
    readonly wrap = input<KbqFlexWrap>('nowrap');
    readonly changes = output<ReadonlySet<unknown>>();
    readonly hiddenItemIDs: Signal<ReadonlySet<unknown>>;
}
```

- `[reverseOverflowOrder]`: `boolean` — Whether the overflow order should be reversed. Defaults to `false`.

  ```text
  [0, 1, hidden, hidden] ---> [hidden, hidden, 2, 3]
  ```
- `[debounceTime]`: `number` — Debounce time for recalculating items visibility. Defaults to `0`.
- `[additionalResizeObserverTargets]`: `Element | Element[]` — List of additional elements to observe for resize changes. Defaults to `document.body`.
- `[orientation]`: `KbqOrientation` — Defines the orientation of the overflow items. Defaults to `'horizontal'`.
- `[wrap]`: `KbqFlexWrap` — Defines the wrap of the overflow items. Defaults to `'nowrap'`.
- `(changes)`: `ReadonlySet<unknown>` — Emits the set of hidden items after every recalculation, also when it has not changed: a recalculation shows every
  item before it hides the overflown ones again, so a consumer that hides items itself re-applies that here.
- `hiddenItemIDs`: `Signal<ReadonlySet<unknown>>` — Set of hidden item IDs.

### KbqOverflowItemsResult (directive)

Directive for displaying the result of hidden items by the `KbqOverflowItems` directive.

```ts
@Directive({
    selector: '[kbqOverflowItemsResult]',
    exportAs: 'kbqOverflowItemsResult'
})
class KbqOverflowItemsResult extends ElementVisibilityManager {}
```
