Placeholder
Placeholder, PlaceholderCard, and PlaceholderButton render Bootstrap skeleton-loading UI for content that is still loading.
Use them when you want a layout-preserving loading state instead of a spinner. Placeholders are especially useful for cards, lists, dashboard metrics, and delayed HTMX regions.
Import
Basic Usage
Placeholder(width="100%")
Placeholder(width="75%", animation="glow")
Placeholder(width="50%", variant="primary")
Card Skeleton
Button Skeleton
Parameters
| Component | Key Parameters | Notes |
|---|---|---|
Placeholder |
width, height, animation, variant, size |
Low-level skeleton span. |
PlaceholderCard |
show_image, show_title, show_text, animation |
Prebuilt card-shaped loading state. |
PlaceholderButton |
width, animation, variant |
Button-shaped skeleton. |
All three accept **kwargs, including cls, id, style, data_*, and aria_* attributes.
Accessibility
Wrap loading regions with appropriate status text when users need to know that content is changing:
API Reference
faststrap.components.feedback.placeholder.Placeholder(width=None, height=None, animation=UNSET, variant=UNSET, size=UNSET, **kwargs)
Bootstrap Placeholder for skeleton loading screens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
str | None
|
Placeholder width (CSS value, e.g., "100%", "200px") |
None
|
height
|
str | None
|
Placeholder height (CSS value) |
None
|
animation
|
AnimationType | None
|
Animation type (glow or wave) |
UNSET
|
variant
|
str | None
|
Color variant (primary, secondary, etc.) |
UNSET
|
size
|
SizeType | None
|
Size variant (xs, sm, lg) |
UNSET
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|
Returns:
| Type | Description |
|---|---|
Span
|
FastHTML Span element with placeholder classes |
Examples:
Basic placeholder:
With animation:
Colored placeholder:
See Also
Bootstrap docs: https://getbootstrap.com/docs/5.3/components/placeholders/
Source code in src/faststrap/components/feedback/placeholder.py
faststrap.components.feedback.placeholder.PlaceholderCard(show_image=True, show_title=True, show_text=True, animation=UNSET, **kwargs)
Pre-built Card skeleton placeholder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_image
|
bool
|
Show image placeholder at top |
True
|
show_title
|
bool
|
Show title placeholder |
True
|
show_text
|
bool
|
Show text placeholders |
True
|
animation
|
AnimationType | None
|
Animation type (glow or wave) |
UNSET
|
**kwargs
|
Any
|
Additional HTML attributes for card |
{}
|
Returns:
| Type | Description |
|---|---|
Div
|
FastHTML Div element with card skeleton |
Examples:
Full card skeleton:
Title and text only:
See Also
Bootstrap docs: https://getbootstrap.com/docs/5.3/components/placeholders/
Source code in src/faststrap/components/feedback/placeholder.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
faststrap.components.feedback.placeholder.PlaceholderButton(width='100px', animation=UNSET, variant='primary', **kwargs)
Button-shaped placeholder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
str
|
Button width |
'100px'
|
animation
|
AnimationType | None
|
Animation type (glow or wave) |
UNSET
|
variant
|
str
|
Button color variant |
'primary'
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|
Returns:
| Type | Description |
|---|---|
Span
|
FastHTML Span element styled as button placeholder |
Examples:
See Also
Bootstrap docs: https://getbootstrap.com/docs/5.3/components/placeholders/