A skeleton is a temporary placeholder that previews the approximate shape of content while it loads. Use one when you know where the elements will appear.

The <kbq-skeleton> element is a basic rectangular block. Set its width and height with CSS. Combine several blocks into a custom composition when no preset fits.

Presets are ready-made placeholders for Koobiq components. Combine them to create a placeholder for an entire page.

KbqSkeletonTypography creates a placeholder with line heights that match the selected Koobiq typography style. When there are several lines, their widths alternate randomly. The uneven right edge makes the placeholder look more like a paragraph.

Placeholders for buttons, badges, tags, icons, and links match the height of their components. You can set their width with CSS.

KbqSkeletonGroup displays a row of placeholders of the same type: buttons, badges, tags, icons, or links.

The KbqSkeletonDl component displays a placeholder for a set of parameters and their values.

While a table or AG Grid is loading, KbqSkeletonTable imitates its structure. You can set:

  • the number of columns and the width of each column;
  • the number of rows;
  • whether to show checkboxes for selecting rows.

KbqSkeletonFormField shows the label, field, and hint below it as one placeholder. The preset supports a multiline field and a label placed to its left.

KbqSkeletonAccordion displays a placeholder for the accordion component. The skeleton shows all groups collapsed.

KbqSkeletonCheckable displays simplified placeholders for the label and a checkbox, radio button, or toggle. You can also show a hint.

KbqSkeletonTabs creates a placeholder for tabs. You can customize the tab content. By default, it shows lines of text.

KbqSkeletonTree displays a placeholder for a hierarchical list. The second node is expanded to show the nested structure.

Use kbqSkeletonPresetsConfigurationProvider to configure presets for the entire application or individual pages.

import { kbqSkeletonPresetsConfigurationProvider } from '@koobiq/components/skeleton';

@Component({
    providers: [
        kbqSkeletonPresetsConfigurationProvider({
            typographyLines: 1,
            dlRows: 3,
            tableRows: 3,
            tableColumns: 3,
            groupCount: 3,
            accordionRows: 3,
            checkableRows: 1,
            tabsCount: 3,
            tabsContentLines: 3,
            treeRows: 3,
            treeChildren: 3
        })
    ]
})

The kbqSkeleton directive turns rendered elements and their content into placeholders that preserve their size.

Denial-of-service attack
Critical
Protection is enabled on three servers
In computing, a denial-of-service attack (DoS attack) is a cyber-attack in which the perpetrator seeks to make a machine or network resource unavailable to its intended users by temporarily or indefinitely disrupting services of a host connected to a network.

While the code block loads, a fixed-height skeleton appears in its place.

Data loads in parts. Placeholders disappear as the data updates.

Use a skeleton when:

  • The page or section structure is known in advance, and the data is loading for the first time.
  • Loading takes a few seconds.

Do not use a skeleton in these cases:

  • Loading takes less than 1 second; the skeleton can appear briefly and cause the interface to flicker.
  • Use a progress spinner when an action is in progress, such as saving, deleting, or submitting a form.
  • For long-running tasks, such as file conversion or data transfer, use a progress bar or a progress spinner.
  • You can keep the previous content on screen during an update. Show the update state separately.
  • Another indicator already shows that content is loading.
Suggestions for improvement
If you found a mistake or want to improve the article, create an issue on GitHub.