Skip to content

Commit 16be428

Browse files
committed
Add skeleton.py in chartlets.py
1 parent ee4fb76 commit 16be428

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

chartlets.py/chartlets/components/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .radiogroup import Radio
1111
from .radiogroup import RadioGroup
1212
from .select import Select
13+
from .skeleton import Skeleton
1314
from .slider import Slider
1415
from .switch import Switch
1516
from .tabs import Tab

chartlets.py/chartlets/components/charts/vega.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ class VegaChart(Component):
3636
chart: altair.Chart | None = None
3737
"""The [Vega Altair chart](https://altair-viz.github.io/gallery/index.html)."""
3838

39+
skeletonProps: dict[str, Any] | None = None
40+
"""Add the skeleton props from the Skeleton MUI component to render a
41+
skeleton during long loading times."""
42+
3943
def to_dict(self) -> dict[str, Any]:
4044
d = super().to_dict()
4145
if self.chart is not None:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from dataclasses import dataclass
2+
from typing import Literal
3+
4+
from chartlets import Component
5+
6+
7+
@dataclass(frozen=True)
8+
class Skeleton(Component):
9+
"""Display a placeholder preview of your content before the data gets
10+
loaded to reduce load-time frustration."""
11+
12+
variant: Literal["text", "rectangular", "circular", "rounded"] | str | None\
13+
= None
14+
"""The type of skeleton to display."""
15+
16+
width: str | int | None = None
17+
"""Width of the skeleton. Can be a number (pixels) or a string (e.g., '100%')."""
18+
19+
height: str | int | None = None
20+
"""Height of the skeleton. Can be a number (pixels) or a string (e.g., '50px')."""
21+
22+
animation: Literal["pulse", "wave", False] | None = None
23+
"""The animation effect to use.
24+
- 'pulse': A subtle pulsing animation.
25+
- 'wave': A shimmering animation.
26+
- False: No animation.
27+
"""

0 commit comments

Comments
 (0)