Loaders
Spinner + React JS / TS
body,
html {
margin: 0;
padding: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #f0f0f0;
}
.spinner {
width: 6.4rem;
height: 6.4rem;
border-radius: 50%;
background:
radial-gradient(farthest-side, #3498db 94%, #0000) top/10px 10px no-repeat,
conic-gradient(#0000 30%, #3498db);
-webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 10px), #000 0);
mask: radial-gradient(farthest-side, #0000 calc(100% - 10px), #000 0);
animation: rotate 1.5s infinite linear;
}
@keyframes rotate {
to {
transform: rotate(1turn);
}
}
Loading indicator with dependency on received data
https://jsonplaceholder.typicode.com/ used for this example
body,
html {
margin: 0;
padding: 0;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}
.progress-container {
width: 450px; /* Increase the width to 80% of the container */
background-color: #ddd;
border-radius: 10px;
overflow: hidden;
margin-bottom: 20px; /* Increase the margin below the bar */
}
.progress-bar {
height: 50px; /* Increase the height of the progress bar */
width: 300px;
background-color: #3498db;
border-radius: 10px;
transition: width 0.25s;
}
.progress-text {
font-size: 1.5em; /* Increase the size of the text */
color: #333;
}
Loading indicator with dependency on received data + React JS / TS
https://jsonplaceholder.typicode.com/ used for this example
.loader-container {
width: 300px;
margin: 100px auto;
text-align: center;
}
.progress-bar {
position: relative;
height: 20px;
background-color: #e0e0e0;
border-radius: 10px;
overflow: hidden;
margin-bottom: 10px;
}
.progress {
height: 100%;
background-color: #2196f3;
transition: width 0.4s ease;
}
.progress-bar span {
position: absolute;
width: 100%;
top: 0;
left: 0;
text-align: center;
font-weight: bold;
line-height: 20px;
}
Skeletons
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
padding: 20px;
}
.skeleton {
background-color: #e0e0e0;
border-radius: 4px;
overflow: hidden;
position: relative;
}
.skeleton::before {
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-image: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.6) 50%,
rgba(255, 255, 255, 0) 100%
);
animation: shimmer 2s infinite;
}
@keyframes shimmer {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}
.dashboard-skeleton {
display: flex;
flex-direction: column;
gap: 20px;
}
.skeleton-title {
width: 200px;
height: 40px;
}
.card-container {
display: flex;
gap: 20px;
}
.skeleton-card {
width: 100%;
height: 120px;
background-color: #e0e0e0;
}
.content-section {
display: flex;
gap: 20px;
}
.skeleton-chart {
flex: 2;
height: 300px;
background-color: #e0e0e0;
}
.skeleton-invoice {
flex: 1;
height: 300px;
background-color: #e0e0e0;
}