Developers may improve the user experience of the application by using placeholders. It can be made without JavaScript because they are just developed with HTML and CSS. Toggling their visibility, however, will require some unique JavaScript. With the aid of the utility classes, developers can simply alter their shape, color, and size.
The example that follows recreates a normal card component with added placeholders to produce a "loading card." The dimensions and proportions of the two are the same.
With the .placeholder class and a grid column class (like.col-6) to specify the width, create placeholders. They may be added to an existing component as a modifier class or may be used to replace text within an element.
To guarantee that the height is respected, there is an addition of extra styling to .btns via ::before. If other scenarios require it, developers can extend this pattern, or developers can put an inside the element to reflect the height when actual text is produced in its place.
The use of aria-hidden="true" only indicates that the element should be hidden to screen readers. The loading behavior of the placeholder depends on how authors will actually use the placeholder styles, how they plan to update things, etc. Some JavaScript code may be needed to swap the state of the placeholder and inform AT users of the update.
The size of .placeholders are based on the typographic style of the parent element. Customize them with sizing modifiers: .placeholder-lg, .placeholder-sm, or .placeholder-xs.