Skeleton
An animated placeholder shown while content loads.
Installation
Shadwire follows shadcn/ui's open code model: the component's source is copied into your application and becomes yours. Install it with the CLI:
The skeleton registry item installs these files:
-
app/components/ui_component.rb -
app/components/ui/skeleton_component.rb -
app/helpers/ui/skeleton_helper.rb -
vendor/shadwire/shadwire.css
Haven't installed the CLI yet? gem install shadwire, then shadwire init.
Usage
Size each placeholder with utility classes. The skeleton is decorative
by default (aria-hidden="true");
announce the loading state on an element of its own (e.g. a region with
aria-busy).
Or render the component
Ui::SkeletonComponent
directly:
Examples
Default
Combine shapes to sketch the content that is loading.
Card
A placeholder for media cards with lines of text.
API reference
ui_skeleton(**options, &block)
wraps
Ui::SkeletonComponent.new(**options).
| Argument | Type | Default | Description |
|---|---|---|---|
class / class_name |
String | nil |
The placeholder's size and shape (h-4 w-48, rounded-full, …). |
**attrs |
Hash | {} |
Free-form HTML attributes. aria: { hidden: "false" } exposes the element to screen readers. |