Skip to content

Commit c5775eb

Browse files
committed
feat(skeleton): added Skeleton Loading with Examples
1 parent 40e4e87 commit c5775eb

29 files changed

+1146
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: React Skeleton - Flowbite
3+
description: The skeleton component can be used as an alternative loading indicator to the spinner by mimicking the content that will be loaded such as text, images, or video
4+
---
5+
6+
Use the skeleton component to indicate a loading status with placeholder elements that look very similar to the type of content that is being loaded such as paragraphs, heading, images, videos, and more.
7+
8+
You can set the width and height of these skeleton components based on the size of the content and element that it is being loaded in, such as a card or an article page.
9+
10+
Start using the skeleton component by importing it from the `flowbite-react` library:
11+
12+
```jsx
13+
import { Skeleton } from "flowbite-react";
14+
```
15+
16+
# Variants
17+
18+
## Default
19+
20+
Represents a single line of text.
21+
22+
<Example name="skeleton.root" />
23+
24+
## Circular
25+
26+
<Example name="skeleton.circular" />
27+
28+
## Rectangular
29+
30+
<Example name="skeleton.rectangular" />
31+
32+
## Rounded
33+
34+
<Example name="skeleton.rounded" />
35+
36+
# Examples
37+
38+
## Image placeholder
39+
40+
This example can be used to show a placeholder when loading an image and text content.
41+
42+
<Example name="skeleton.image" />
43+
44+
## Video placeholder
45+
46+
Use this example to show a skeleton placeholder when loading video content.
47+
48+
<Example name="skeleton.video" />
49+
50+
## Card placeholder
51+
52+
Use this example to show a placeholder when loading content inside a card.
53+
54+
<Example name="skeleton.card" />
55+
56+
## List placeholder
57+
58+
Use this example to show a placeholder when loading a list of items.
59+
60+
<Example name="skeleton.list" />
61+
62+
## Testimonial placeholder
63+
64+
Use this example to show a placeholder when loading a list of items.
65+
66+
<Example name="skeleton.testimonial" />
67+
68+
# Theme
69+
70+
To learn more about how to customize the appearance of components, please see the [Theme docs](/docs/customize/theme).
71+
72+
<Theme name="skeleton" />
73+
74+
# References
75+
76+
- [Flowbite Skeleton](https://flowbite.com/docs/components/skeleton/)

apps/web/data/components.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ export const COMPONENTS_DATA: Component[] = [
140140
link: "/docs/components/sidebar",
141141
classes: "w-16",
142142
},
143+
{
144+
name: "Skeleton",
145+
image: "/images/components/skeleton.svg",
146+
imageDark: "/images/components/skeleton-dark.svg",
147+
link: "/docs/components/skeleton",
148+
classes: "w-48",
149+
},
143150
{
144151
name: "Pagination",
145152
image: "/images/components/pagination.svg",

apps/web/data/docs-sidebar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const DOCS_SIDEBAR: DocsSidebarSection[] = [
7676
{ title: "Progress bar", href: "/docs/components/progress" },
7777
{ title: "Rating", href: "/docs/components/rating" },
7878
{ title: "Sidebar", href: "/docs/components/sidebar" },
79+
{ title: "Skeleton", href: "/docs/components/skeleton", isNew: true },
7980
{ title: "Spinner", href: "/docs/components/spinner" },
8081
{ title: "Table", href: "/docs/components/table" },
8182
{ title: "Tabs", href: "/docs/components/tabs" },

apps/web/examples/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export * as popover from "./popover";
2525
export * as progress from "./progress";
2626
export * as rating from "./rating";
2727
export * as sidebar from "./sidebar";
28+
export * as skeleton from "./skeleton";
2829
export * as spinner from "./spinner";
2930
export * as table from "./table";
3031
export * as tabs from "./tabs";

apps/web/examples/skeleton/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export { card } from "./skeleton.card";
2+
export { circular } from "./skeleton.circular";
3+
export { image } from "./skeleton.image";
4+
export { list } from "./skeleton.list";
5+
export { rectangular } from "./skeleton.rectangular";
6+
export { rounded } from "./skeleton.rounded";
7+
export { root } from "./skeleton.root";
8+
export { testimonial } from "./skeleton.testimonial";
9+
export { video } from "./skeleton.video";
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { SkeletonCard } from "flowbite-react";
2+
import type { CodeData } from "~/components/code-demo";
3+
4+
const code = `
5+
'use client';
6+
7+
import { Skeleton } from "flowbite-react";
8+
9+
function Component() {
10+
return (
11+
<div>
12+
<Skeleton.Card />
13+
</div>
14+
)
15+
}
16+
`;
17+
18+
const codeRSC = `
19+
import { SkeletonCard } from "flowbite-react";
20+
21+
function Component() {
22+
return (
23+
<div>
24+
<SkeletonCard />
25+
</div>
26+
)
27+
}
28+
`;
29+
30+
function Component() {
31+
return (
32+
<div>
33+
<SkeletonCard />
34+
</div>
35+
);
36+
}
37+
38+
export const card: CodeData = {
39+
type: "single",
40+
code: [
41+
{
42+
fileName: "client",
43+
language: "tsx",
44+
code,
45+
},
46+
{
47+
fileName: "server",
48+
language: "tsx",
49+
code: codeRSC,
50+
},
51+
],
52+
githubSlug: "skeleton/skeleton.card.tsx",
53+
component: <Component />,
54+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Skeleton } from "flowbite-react";
2+
import type { CodeData } from "~/components/code-demo";
3+
4+
const code = `
5+
'use client';
6+
7+
import { Skeleton } from "flowbite-react";
8+
9+
function Component() {
10+
return (
11+
<div>
12+
<Skeleton variant="circular" />
13+
</div>
14+
)
15+
}
16+
`;
17+
18+
const codeRSC = `
19+
import { Skeleton } from "flowbite-react";
20+
21+
function Component() {
22+
return (
23+
<div>
24+
<Skeleton variant="circular" />
25+
</div>
26+
)
27+
}
28+
`;
29+
30+
function Component() {
31+
return (
32+
<div>
33+
<Skeleton variant="circular" />
34+
</div>
35+
);
36+
}
37+
38+
export const circular: CodeData = {
39+
type: "single",
40+
code: [
41+
{
42+
fileName: "client",
43+
language: "tsx",
44+
code,
45+
},
46+
{
47+
fileName: "server",
48+
language: "tsx",
49+
code: codeRSC,
50+
},
51+
],
52+
githubSlug: "skeleton/skeleton.circular.tsx",
53+
component: <Component />,
54+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { SkeletonImage } from "flowbite-react";
2+
import type { CodeData } from "~/components/code-demo";
3+
4+
const code = `
5+
'use client';
6+
7+
import { Skeleton } from "flowbite-react";
8+
9+
function Component() {
10+
return (
11+
<div>
12+
<Skeleton.Image />
13+
</div>
14+
)
15+
}
16+
`;
17+
18+
const codeRSC = `
19+
import { SkeletonImage } from "flowbite-react";
20+
21+
function Component() {
22+
return (
23+
<div>
24+
<SkeletonImage />
25+
</div>
26+
)
27+
}
28+
`;
29+
30+
function Component() {
31+
return (
32+
<div>
33+
<SkeletonImage />
34+
</div>
35+
);
36+
}
37+
38+
export const image: CodeData = {
39+
type: "single",
40+
code: [
41+
{
42+
fileName: "client",
43+
language: "tsx",
44+
code,
45+
},
46+
{
47+
fileName: "server",
48+
language: "tsx",
49+
code: codeRSC,
50+
},
51+
],
52+
githubSlug: "skeleton/skeleton.image.tsx",
53+
component: <Component />,
54+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { SkeletonList } from "flowbite-react";
2+
import type { CodeData } from "~/components/code-demo";
3+
4+
const code = `
5+
'use client';
6+
7+
import { Skeleton } from "flowbite-react";
8+
9+
function Component() {
10+
return (
11+
<div>
12+
<Skeleton.List />
13+
</div>
14+
)
15+
}
16+
`;
17+
18+
const codeRSC = `
19+
import { SkeletonList } from "flowbite-react";
20+
21+
function Component() {
22+
return (
23+
<div>
24+
<SkeletonList />
25+
</div>
26+
)
27+
}
28+
`;
29+
30+
function Component() {
31+
return (
32+
<div>
33+
<SkeletonList />
34+
</div>
35+
);
36+
}
37+
38+
export const list: CodeData = {
39+
type: "single",
40+
code: [
41+
{
42+
fileName: "client",
43+
language: "tsx",
44+
code,
45+
},
46+
{
47+
fileName: "server",
48+
language: "tsx",
49+
code: codeRSC,
50+
},
51+
],
52+
githubSlug: "skeleton/skeleton.list.tsx",
53+
component: <Component />,
54+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Skeleton } from "flowbite-react";
2+
import type { CodeData } from "~/components/code-demo";
3+
4+
const code = `
5+
'use client';
6+
7+
import { Skeleton } from "flowbite-react";
8+
9+
function Component() {
10+
return (
11+
<div>
12+
<Skeleton variant="rectangular" />
13+
</div>
14+
)
15+
}
16+
`;
17+
18+
const codeRSC = `
19+
import { Skeleton } from "flowbite-react";
20+
21+
function Component() {
22+
return (
23+
<div>
24+
<Skeleton variant="rectangular" />
25+
</div>
26+
)
27+
}
28+
`;
29+
30+
function Component() {
31+
return (
32+
<div>
33+
<Skeleton variant="rectangular" />
34+
</div>
35+
);
36+
}
37+
38+
export const rectangular: CodeData = {
39+
type: "single",
40+
code: [
41+
{
42+
fileName: "client",
43+
language: "tsx",
44+
code,
45+
},
46+
{
47+
fileName: "server",
48+
language: "tsx",
49+
code: codeRSC,
50+
},
51+
],
52+
githubSlug: "skeleton/skeleton.rectangular.tsx",
53+
component: <Component />,
54+
};

0 commit comments

Comments
 (0)