Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Skeleton component documentation #862

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/library/other/skeleton.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
description: Skeleton, a loading placeholder component for content that is not yet available.
components:
- rx.skeleton
---

```python exec
import reflex as rx
```

# Skeleton (loading placeholder)

`Skeleton` is a loading placeholder component that serves as a visual placeholder while content is loading.
It is useful for maintaining the layout's structure and providing users with a sense of progression while awaiting the final content.

```python demo
rx.vstack(
rx.skeleton(rx.button("button-small"), height="10px"),
rx.skeleton(rx.button("button-big"), height="20px"),
rx.skeleton(rx.text("Text is loaded."), loading=True,),
rx.skeleton(rx.text("Text is already loaded."), loading=False,),
),
```

When using `Skeleton` with text, wrap the text itself instead of the parent element to have a placeholder of the same size.

Use the loading prop to control whether the skeleton or its children are displayed. Skeleton preserves the dimensions of children when they are hidden and disables interactive elements.
Loading