# API of `@koobiq/components/skeleton`

Documented on [Skeleton](https://koobiq.io/en/components/skeleton.md). NgModule: `KbqSkeletonModule`.

## Components

### KbqSkeletonAccordion (component)

Placeholder of an accordion whose items have not loaded yet: collapsed items with their icon and title.

```ts
@Component({ selector: 'kbq-skeleton-accordion' })
class KbqSkeletonAccordion {
    readonly rows = input<number>(this.configuration.accordionRows);
}
```

- `[rows]`: `number` — Number of collapsed items, `accordionRows` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.

### KbqSkeletonBadge (component)

Placeholder of a badge whose data has not loaded yet.

```ts
@Component({ selector: 'kbq-skeleton-badge' })
class KbqSkeletonBadge {}
```

### KbqSkeletonButton (component)

Placeholder of a button whose data has not loaded yet.

```ts
@Component({ selector: 'kbq-skeleton-button' })
class KbqSkeletonButton {}
```

### KbqSkeletonCheckable (component)

Placeholder of checkboxes, radio buttons or toggles whose data has not loaded yet: the control, and the label with
its hint on demand.

```ts
@Component({ selector: 'kbq-skeleton-checkable' })
class KbqSkeletonCheckable {
    readonly control = input<KbqSkeletonCheckableControl>('checkbox');
    readonly rows = input<number>(this.configuration.checkableRows);
    readonly label = input<boolean>(true);
    readonly hint = input<boolean>(false);
}
```

- `[control]`: `KbqSkeletonCheckableControl` — Control the placeholder stands in for.
- `[rows]`: `number` — Number of controls, `checkableRows` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.
- `[label]`: `boolean` — Whether a control has a label.
- `[hint]`: `boolean` — Whether the label has a hint below it.

### KbqSkeletonDl (component)

Placeholder of a description list whose data has not loaded yet.

```ts
@Component({ selector: 'kbq-skeleton-dl' })
class KbqSkeletonDl {
    readonly rows = input<number>(this.configuration.dlRows);
}
```

- `[rows]`: `number` — Number of terms with their descriptions, `dlRows` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.

### KbqSkeletonFormField (component)

Placeholder of a form field whose value has not loaded yet: its label, control and hint.

```ts
@Component({ selector: 'kbq-skeleton-form-field' })
class KbqSkeletonFormField {
    readonly horizontal = input<boolean>(false);
    readonly control = input<KbqSkeletonFormFieldControl>('input');
    readonly label = input<boolean>(true);
    readonly hint = input<boolean>(false);
    readonly labelClass = input<string | string[] | Set<string>>();
    readonly contentClass = input<string | string[] | Set<string>>();
}
```

- `[horizontal]`: `boolean` — Whether the label is to the left of the control, as in a horizontal `kbq-form-field`.
- `[control]`: `KbqSkeletonFormFieldControl` — Control of the form field.
- `[label]`: `boolean` — Whether the form field has a label, as a `kbq-form-field` with `kbq-label`.
- `[hint]`: `boolean` — Whether the form field has a hint below the control.
- `[labelClass]`: `string | string[] | Set<string>` — Classes of the label, such as the `labelClass` of the `kbq-form-field` the placeholder stands in for.
- `[contentClass]`: `string | string[] | Set<string>` — Classes of the control and the hint, such as the `contentClass` of the `kbq-form-field`.

### KbqSkeletonGroup (component)

Row of placeholders of one kind, such as the tags of a tag list.

```ts
@Component({ selector: 'kbq-skeleton-group' })
class KbqSkeletonGroup {
    readonly preset = input.required<KbqSkeletonGroupPreset>();
    readonly count = input<number>(this.configuration.groupCount);
}
```

- `[preset]`: `KbqSkeletonGroupPreset` — Placeholder of every item of the row.
- `[count]`: `number` — Number of placeholders, `groupCount` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.

### KbqSkeletonIcon (component)

Placeholder of an icon or an icon button whose data has not loaded yet.

```ts
@Component({ selector: 'kbq-skeleton-icon' })
class KbqSkeletonIcon {}
```

### KbqSkeletonLink (component)

Placeholder of a link whose data has not loaded yet.

```ts
@Component({ selector: 'kbq-skeleton-link' })
class KbqSkeletonLink {}
```

### KbqSkeletonTable (component)

Placeholder of a table whose data has not loaded yet.

```ts
@Component({ selector: 'kbq-skeleton-table' })
class KbqSkeletonTable {
    readonly rows = input<number>(this.configuration.tableRows);
    readonly columns = input<readonly string[]>(
        equalColumns(this.configuration.tableColumns)
    );
    readonly header = input<boolean>(true);
    readonly selectable = input<boolean>(false);
    readonly pinnedColumns = input<number>(0);
}
```

- `[rows]`: `number` — Number of rows below the header, `tableRows` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.
- `[columns]`: `readonly string[]` — Number of columns of equal width, `tableColumns` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default, or the
  width of every column as a CSS grid track, such as `160px`, `1fr` or `auto`, for a table whose columns are known.
- `[header]`: `boolean` — Whether the table has a header row.
- `[selectable]`: `boolean` — Whether every row starts with a checkbox, as in a grid whose rows can be selected.
- `[pinnedColumns]`: `number` — Number of columns pinned to the start and set apart from the rest by a line, as in a grid.

### KbqSkeletonTabs (component)

Placeholder of tabs whose data has not loaded yet: the first tab stands out as the selected one. The content below
or beside them is text, or the placeholders projected into the component.

```ts
@Component({ selector: 'kbq-skeleton-tabs' })
class KbqSkeletonTabs {
    readonly vertical = input<boolean>(false);
    readonly count = input<number>(this.configuration.tabsCount);
    readonly contentLines = input<number>(
        this.configuration.tabsContentLines
    );
}
```

- `[vertical]`: `boolean` — Whether the tabs are stacked beside the content, as in a vertical `kbq-tab-group`.
- `[count]`: `number` — Number of tabs, `tabsCount` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.
- `[contentLines]`: `number` — Number of lines of the text that stands for the content when nothing is projected, `tabsContentLines` of
  `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.

### KbqSkeletonTag (component)

Placeholder of a tag whose data has not loaded yet.

```ts
@Component({ selector: 'kbq-skeleton-tag' })
class KbqSkeletonTag {}
```

### KbqSkeletonTree (component)

Placeholder of a tree whose nodes have not loaded yet, with the second node expanded.

```ts
@Component({ selector: 'kbq-skeleton-tree' })
class KbqSkeletonTree {
    readonly rows = input<number>(this.configuration.treeRows);
    readonly children = input<number>(this.configuration.treeChildren);
}
```

- `[rows]`: `number` — Number of top-level nodes, `treeRows` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.
- `[children]`: `number` — Number of children of the expanded second node, `treeChildren` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by
  default.

### KbqSkeletonTypography (component)

Placeholder of text that has not loaded yet: lines as tall as the lines of its typography level, a line of body text
by default. A single line, such as a heading, is shorter than the lines of a paragraph, which differ in length.

```ts
@Component({ selector: 'kbq-skeleton-typography' })
class KbqSkeletonTypography {
    readonly level = input<string>('text-normal');
    readonly lines = input<number>(this.configuration.typographyLines);
}
```

- `[level]`: `string` — Typography level of the text, the name of its class without `kbq-`, such as `title` or `caps-compact`.
- `[lines]`: `number` — Number of lines, `typographyLines` of `KBQ_SKELETON_PRESETS_CONFIGURATION` by default.

## Directives

### KbqSkeleton (directive)

Directive representing a skeleton placeholder.

Paints the host, children included, as one flat shape of the host's own outline with a wave running across it,
and makes the host inert: it leaves the tab order and the accessibility tree until the skeleton is disabled.

```ts
@Directive({ selector: 'kbq-skeleton, [kbqSkeleton]', exportAs: 'kbqSkeleton' })
class KbqSkeleton {
    readonly enabled = input<boolean>(true, { alias: 'kbqSkeleton' });
}
```

- `[kbqSkeleton]`: `boolean` — Whether the skeleton is enabled.

## Types

### KbqSkeletonCheckableControl (type)

Control a checkable placeholder stands in for.

```ts
type KbqSkeletonCheckableControl = 'checkbox' | 'radio' | 'toggle';
```

### KbqSkeletonFormFieldControl (type)

Control a form field placeholder stands in for.

```ts
type KbqSkeletonFormFieldControl = 'input' | 'textarea';
```

### KbqSkeletonGroupPreset (type)

Placeholder a group repeats in a row.

```ts
type KbqSkeletonGroupPreset = 'button' | 'badge' | 'tag' | 'icon' | 'link';
```

### KbqSkeletonPresetsConfiguration (interface)

Numbers of items the skeleton presets show until the amount of data is known.

```ts
interface KbqSkeletonPresetsConfiguration {
    typographyLines: number;
    dlRows: number;
    tableRows: number;
    tableColumns: number;
    groupCount: number;
    accordionRows: number;
    checkableRows: number;
    tabsCount: number;
    tabsContentLines: number;
    treeRows: number;
    treeChildren: number;
}
```

- `typographyLines`: `number` — Number of lines of `kbq-skeleton-typography`.
- `dlRows`: `number` — Number of rows of `kbq-skeleton-dl`.
- `tableRows`: `number` — Number of rows of `kbq-skeleton-table`.
- `tableColumns`: `number` — Number of columns of `kbq-skeleton-table`.
- `groupCount`: `number` — Number of placeholders of `kbq-skeleton-group`.
- `accordionRows`: `number` — Number of collapsed items of `kbq-skeleton-accordion`.
- `checkableRows`: `number` — Number of controls of `kbq-skeleton-checkable`.
- `tabsCount`: `number` — Number of tabs of `kbq-skeleton-tabs`.
- `tabsContentLines`: `number` — Number of lines of the text in the content of `kbq-skeleton-tabs`.
- `treeRows`: `number` — Number of top-level nodes of `kbq-skeleton-tree`.
- `treeChildren`: `number` — Number of children of the expanded node of `kbq-skeleton-tree`.

## Constants

### KBQ_SKELETON_PRESETS_CONFIGURATION (const)

Numbers of items of the skeleton presets.

```ts
const KBQ_SKELETON_PRESETS_CONFIGURATION: InjectionToken<KbqSkeletonPresetsConfiguration>;
```

### kbqSkeletonPresetsConfigurationProvider (const)

Utility provider for `KBQ_SKELETON_PRESETS_CONFIGURATION`, for an application or a part of it. The keys it leaves
out keep the values of the closest provider above.

```ts
const kbqSkeletonPresetsConfigurationProvider: (
    configuration: Partial<KbqSkeletonPresetsConfiguration>
) => Provider;
```
