-
-
Notifications
You must be signed in to change notification settings - Fork 455
feat(skeleton): added Skeleton Loading with Examples #1332
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
Open
dhavalveera
wants to merge
3
commits into
themesberg:main
Choose a base branch
from
dhavalveera:feat/skeleton
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
title: React Skeleton - Flowbite | ||
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 | ||
--- | ||
|
||
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. | ||
|
||
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. | ||
|
||
Start using the skeleton component by importing it from the `flowbite-react` library: | ||
|
||
```jsx | ||
import { Skeleton } from "flowbite-react"; | ||
``` | ||
|
||
# Variants | ||
|
||
## Default | ||
|
||
Represents a single line of text. | ||
|
||
<Example name="skeleton.root" /> | ||
|
||
## Circular | ||
|
||
<Example name="skeleton.circular" /> | ||
|
||
## Rectangular | ||
|
||
<Example name="skeleton.rectangular" /> | ||
|
||
## Rounded | ||
|
||
<Example name="skeleton.rounded" /> | ||
|
||
# Examples | ||
|
||
## Image placeholder | ||
|
||
This example can be used to show a placeholder when loading an image and text content. | ||
|
||
<Example name="skeleton.image" /> | ||
|
||
## Video placeholder | ||
|
||
Use this example to show a skeleton placeholder when loading video content. | ||
|
||
<Example name="skeleton.video" /> | ||
|
||
## Card placeholder | ||
|
||
Use this example to show a placeholder when loading content inside a card. | ||
|
||
<Example name="skeleton.card" /> | ||
|
||
## List placeholder | ||
|
||
Use this example to show a placeholder when loading a list of items. | ||
|
||
<Example name="skeleton.list" /> | ||
|
||
## Testimonial placeholder | ||
|
||
Use this example to show a placeholder when loading a list of items. | ||
|
||
<Example name="skeleton.testimonial" /> | ||
|
||
# Theme | ||
|
||
To learn more about how to customize the appearance of components, please see the [Theme docs](/docs/customize/theme). | ||
|
||
<Theme name="skeleton" /> | ||
|
||
# References | ||
|
||
- [Flowbite Skeleton](https://flowbite.com/docs/components/skeleton/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export { card } from "./skeleton.card"; | ||
export { circular } from "./skeleton.circular"; | ||
export { image } from "./skeleton.image"; | ||
export { list } from "./skeleton.list"; | ||
export { rectangular } from "./skeleton.rectangular"; | ||
export { rounded } from "./skeleton.rounded"; | ||
export { root } from "./skeleton.root"; | ||
export { testimonial } from "./skeleton.testimonial"; | ||
export { video } from "./skeleton.video"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { SkeletonCard } from "flowbite-react"; | ||
import type { CodeData } from "~/components/code-demo"; | ||
|
||
const code = ` | ||
'use client'; | ||
|
||
import { Skeleton } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton.Card /> | ||
</div> | ||
) | ||
} | ||
`; | ||
dhavalveera marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const codeRSC = ` | ||
import { SkeletonCard } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<SkeletonCard /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<SkeletonCard /> | ||
</div> | ||
); | ||
} | ||
|
||
export const card: CodeData = { | ||
type: "single", | ||
code: [ | ||
{ | ||
fileName: "client", | ||
language: "tsx", | ||
code, | ||
}, | ||
{ | ||
fileName: "server", | ||
language: "tsx", | ||
code: codeRSC, | ||
}, | ||
], | ||
githubSlug: "skeleton/skeleton.card.tsx", | ||
component: <Component />, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Skeleton } from "flowbite-react"; | ||
import type { CodeData } from "~/components/code-demo"; | ||
|
||
const code = ` | ||
'use client'; | ||
|
||
import { Skeleton } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton variant="circular" /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
const codeRSC = ` | ||
import { Skeleton } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton variant="circular" /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton variant="circular" /> | ||
</div> | ||
); | ||
} | ||
|
||
export const circular: CodeData = { | ||
type: "single", | ||
code: [ | ||
{ | ||
fileName: "client", | ||
language: "tsx", | ||
code, | ||
}, | ||
{ | ||
fileName: "server", | ||
language: "tsx", | ||
code: codeRSC, | ||
}, | ||
], | ||
githubSlug: "skeleton/skeleton.circular.tsx", | ||
component: <Component />, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { SkeletonImage } from "flowbite-react"; | ||
import type { CodeData } from "~/components/code-demo"; | ||
|
||
const code = ` | ||
'use client'; | ||
|
||
import { Skeleton } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton.Image /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
const codeRSC = ` | ||
import { SkeletonImage } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<SkeletonImage /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<SkeletonImage /> | ||
</div> | ||
); | ||
} | ||
|
||
export const image: CodeData = { | ||
type: "single", | ||
code: [ | ||
{ | ||
fileName: "client", | ||
language: "tsx", | ||
code, | ||
}, | ||
{ | ||
fileName: "server", | ||
language: "tsx", | ||
code: codeRSC, | ||
}, | ||
], | ||
githubSlug: "skeleton/skeleton.image.tsx", | ||
component: <Component />, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { SkeletonList } from "flowbite-react"; | ||
import type { CodeData } from "~/components/code-demo"; | ||
|
||
const code = ` | ||
'use client'; | ||
|
||
import { Skeleton } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton.List /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
const codeRSC = ` | ||
import { SkeletonList } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<SkeletonList /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<SkeletonList /> | ||
</div> | ||
); | ||
} | ||
|
||
export const list: CodeData = { | ||
type: "single", | ||
code: [ | ||
{ | ||
fileName: "client", | ||
language: "tsx", | ||
code, | ||
}, | ||
{ | ||
fileName: "server", | ||
language: "tsx", | ||
code: codeRSC, | ||
}, | ||
], | ||
githubSlug: "skeleton/skeleton.list.tsx", | ||
component: <Component />, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Skeleton } from "flowbite-react"; | ||
import type { CodeData } from "~/components/code-demo"; | ||
|
||
const code = ` | ||
'use client'; | ||
|
||
import { Skeleton } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton variant="rectangular" /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
const codeRSC = ` | ||
import { Skeleton } from "flowbite-react"; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton variant="rectangular" /> | ||
</div> | ||
) | ||
} | ||
`; | ||
|
||
function Component() { | ||
return ( | ||
<div> | ||
<Skeleton variant="rectangular" /> | ||
</div> | ||
); | ||
} | ||
|
||
export const rectangular: CodeData = { | ||
type: "single", | ||
code: [ | ||
{ | ||
fileName: "client", | ||
language: "tsx", | ||
code, | ||
}, | ||
{ | ||
fileName: "server", | ||
language: "tsx", | ||
code: codeRSC, | ||
}, | ||
], | ||
githubSlug: "skeleton/skeleton.rectangular.tsx", | ||
component: <Component />, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.