react-smart-loading-effects 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,336 @@
1
+ # React Smart Loading Effects
2
+
3
+ [![npm version](https://img.shields.io/npm/v/react-smart-loading-effects.svg)](https://www.npmjs.com/package/react-smart-loading-effects)
4
+ [![bundle size](https://img.shields.io/badge/gzip-2.7%20KB-brightgreen)](https://www.npmjs.com/package/react-smart-loading-effects)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-ready-blue)](https://www.npmjs.com/package/react-smart-loading-effects)
6
+ [![license](https://img.shields.io/npm/l/react-smart-loading-effects.svg)](https://www.npmjs.com/package/react-smart-loading-effects)
7
+
8
+ **The easiest way to add beautiful React skeleton loaders to your app.**
9
+
10
+ `react-smart-loading-effects` is a lightweight **React skeleton loader** library with polished **shimmer animation**, zero configuration, and production-ready layouts for the UI patterns you build every day — product cards, data tables, SaaS dashboards, user profiles, notification lists, and article text.
11
+
12
+ Stop hand-coding dozens of placeholder `<div>` elements. Install once, drop in `<SmartLoader />`, and ship professional **loading skeleton screens** in under 30 seconds.
13
+
14
+ ```bash
15
+ npm install react-smart-loading-effects
16
+ ```
17
+
18
+ **Peer dependencies:** React 18+ and React DOM 18+
19
+
20
+ ---
21
+
22
+ ## See it in action
23
+
24
+ ![React skeleton loader overview — card, table, dashboard, profile, list, and text shimmer loaders](https://cdn.jsdelivr.net/npm/react-smart-loading-effects@1.0.0/docs/overview-demo.gif)
25
+
26
+ *Six loader types, one package. GPU-friendly shimmer, accessible defaults, ~2.7 KB gzipped.*
27
+
28
+ ---
29
+
30
+ ## Table of contents
31
+
32
+ - [Why use this library?](#why-use-this-library)
33
+ - [Key features](#key-features)
34
+ - [Quick start](#quick-start)
35
+ - [Loader demos](#loader-demos)
36
+ - [Card skeleton loader](#card-skeleton-loader)
37
+ - [Table skeleton loader](#table-skeleton-loader)
38
+ - [Dashboard skeleton loader](#dashboard-skeleton-loader)
39
+ - [Profile skeleton loader](#profile-skeleton-loader)
40
+ - [List skeleton loader](#list-skeleton-loader)
41
+ - [Text skeleton loader](#text-skeleton-loader)
42
+ - [API reference](#api-reference)
43
+ - [Framework support](#framework-support)
44
+ - [Accessibility](#accessibility)
45
+ - [FAQ](#faq)
46
+ - [Local demo](#local-demo)
47
+ - [License](#license)
48
+
49
+ ---
50
+
51
+ ## Why use this library?
52
+
53
+ Most React apps need **loading placeholders** — but building them from scratch is repetitive:
54
+
55
+ - Card grids need image, title, description, and button skeletons
56
+ - Admin panels need table row and column placeholders
57
+ - Dashboards need KPI cards, chart areas, and sidebar stubs
58
+ - Profile pages need avatar, name, and bio lines
59
+ - Feeds need list items with avatars and text
60
+ - Articles need multi-line text skeletons
61
+
62
+ `react-smart-loading-effects` gives you all of this with a single prop:
63
+
64
+ ```tsx
65
+ <SmartLoader type="table" rows={10} columns={5} />
66
+ ```
67
+
68
+ No CSS imports. No UI framework. No Tailwind dependency. Just beautiful, accessible **React loading states** out of the box.
69
+
70
+ ---
71
+
72
+ ## Key features
73
+
74
+ - **6 production-ready layouts** — card, table, dashboard, profile, list, text
75
+ - **Shimmer animation** — smooth, GPU-accelerated skeleton shimmer (disable with `animated={false}`)
76
+ - **Zero configuration** — styles inject automatically on first render
77
+ - **Tiny bundle** — ~2.7 KB gzipped (ESM)
78
+ - **TypeScript** — full type exports for props and loader types
79
+ - **Accessible** — `aria-busy`, `aria-hidden`, and `prefers-reduced-motion` support
80
+ - **Next.js ready** — works with App Router, Pages Router, and React Server Components consumers
81
+ - **Tree-shakeable** — ESM + CommonJS builds via tsup
82
+
83
+ ---
84
+
85
+ ## Quick start
86
+
87
+ ```tsx
88
+ import { SmartLoader } from "react-smart-loading-effects";
89
+
90
+ function ProductGrid({ loading }: { loading: boolean }) {
91
+ if (loading) {
92
+ return <SmartLoader type="card" />;
93
+ }
94
+ return <ProductCard />;
95
+ }
96
+ ```
97
+
98
+ Use while data is fetching:
99
+
100
+ ```tsx
101
+ {isLoading ? <SmartLoader type="table" rows={8} columns={5} /> : <DataTable data={data} />}
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Loader demos
107
+
108
+ ### Card skeleton loader
109
+
110
+ Perfect for **product cards**, blog post previews, e-commerce grids, and service tiles.
111
+
112
+ ![React card skeleton loader with shimmer — image, title, description, and CTA placeholders](https://cdn.jsdelivr.net/npm/react-smart-loading-effects@1.0.0/docs/card-loader.gif)
113
+
114
+ ```tsx
115
+ <SmartLoader type="card" />
116
+ ```
117
+
118
+ Includes image placeholder (16:9), title bar, description lines, and CTA button skeleton.
119
+
120
+ ---
121
+
122
+ ### Table skeleton loader
123
+
124
+ Ideal for **admin dashboards**, CRM tables, analytics grids, and any paginated data view.
125
+
126
+ ![React table skeleton loader with shimmer — configurable rows and columns](https://cdn.jsdelivr.net/npm/react-smart-loading-effects@1.0.0/docs/table-loader.gif)
127
+
128
+ ```tsx
129
+ <SmartLoader type="table" rows={10} columns={5} />
130
+ ```
131
+
132
+ Configurable `rows` and `columns` with a responsive horizontal scroll wrapper.
133
+
134
+ ---
135
+
136
+ ### Dashboard skeleton loader
137
+
138
+ Built for **SaaS dashboards**, analytics pages, and internal admin tools.
139
+
140
+ ![React dashboard skeleton loader — KPI cards, chart placeholders, and sidebar](https://cdn.jsdelivr.net/npm/react-smart-loading-effects@1.0.0/docs/dashboard-loader.gif)
141
+
142
+ ```tsx
143
+ <SmartLoader type="dashboard" />
144
+ ```
145
+
146
+ Includes KPI stat cards, two chart panel placeholders, and a sidebar navigation strip.
147
+
148
+ ---
149
+
150
+ ### Profile skeleton loader
151
+
152
+ Great for **user profile pages**, team directories, and account settings screens.
153
+
154
+ ![React profile skeleton loader — avatar, name, and bio line placeholders](https://cdn.jsdelivr.net/npm/react-smart-loading-effects@1.0.0/docs/profile-loader.gif)
155
+
156
+ ```tsx
157
+ <SmartLoader type="profile" />
158
+ ```
159
+
160
+ Centered layout with circular avatar, name bar, and multi-line bio placeholders.
161
+
162
+ ---
163
+
164
+ ### List skeleton loader
165
+
166
+ Use for **notification feeds**, message inboxes, activity streams, and comment lists.
167
+
168
+ ![React list skeleton loader — avatar, title, and subtitle rows](https://cdn.jsdelivr.net/npm/react-smart-loading-effects@1.0.0/docs/list-loader.gif)
169
+
170
+ ```tsx
171
+ <SmartLoader type="list" rows={6} />
172
+ ```
173
+
174
+ Each row includes a circular avatar, title line, and subtitle line.
175
+
176
+ ---
177
+
178
+ ### Text skeleton loader
179
+
180
+ Designed for **blog articles**, documentation pages, long-form content, and paragraph loading.
181
+
182
+ ![React text skeleton loader — multi-line content with natural width variation](https://cdn.jsdelivr.net/npm/react-smart-loading-effects@1.0.0/docs/text-loader.gif)
183
+
184
+ ```tsx
185
+ <SmartLoader type="text" rows={8} />
186
+ ```
187
+
188
+ Multiple text rows with varied widths (100%, 92%, 78%) for a natural reading feel.
189
+
190
+ ---
191
+
192
+ ### Static skeleton (no animation)
193
+
194
+ Disable shimmer for static placeholders or when you handle animation yourself:
195
+
196
+ ```tsx
197
+ <SmartLoader type="card" animated={false} />
198
+ ```
199
+
200
+ ---
201
+
202
+ ## API reference
203
+
204
+ ### `SmartLoader`
205
+
206
+ | Prop | Type | Default | Description |
207
+ |------|------|---------|-------------|
208
+ | `type` | `"card" \| "table" \| "dashboard" \| "profile" \| "list" \| "text"` | — | Skeleton layout (required) |
209
+ | `rows` | `number` | varies | Row count for table, list, and text loaders |
210
+ | `columns` | `number` | `4` | Column count for table loader |
211
+ | `animated` | `boolean` | `true` | Enable shimmer skeleton animation |
212
+ | `width` | `number \| string` | `"100%"` | Container width |
213
+ | `height` | `number \| string` | — | Container height |
214
+ | `className` | `string` | — | Additional CSS class on loader root |
215
+
216
+ ### Individual loaders
217
+
218
+ Import loaders directly for finer control:
219
+
220
+ ```tsx
221
+ import {
222
+ CardLoader,
223
+ TableLoader,
224
+ DashboardLoader,
225
+ ProfileLoader,
226
+ ListLoader,
227
+ TextLoader,
228
+ Skeleton,
229
+ } from "react-smart-loading-effects";
230
+
231
+ <CardLoader animated />
232
+ <TableLoader rows={5} columns={4} />
233
+ <Skeleton width={200} height={20} borderRadius={8} />
234
+ ```
235
+
236
+ ### TypeScript
237
+
238
+ ```tsx
239
+ import type { SmartLoaderProps, LoaderType, LoaderCommonProps } from "react-smart-loading-effects";
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Framework support
245
+
246
+ | Framework | Support |
247
+ |-----------|---------|
248
+ | React 18+ | Yes |
249
+ | React 19+ | Yes |
250
+ | Next.js (App Router) | Yes |
251
+ | Next.js (Pages Router) | Yes |
252
+ | Vite | Yes |
253
+ | Create React App | Yes |
254
+
255
+ No CSS file imports required — shimmer keyframes are injected automatically when `SmartLoader` mounts.
256
+
257
+ ### Next.js example
258
+
259
+ ```tsx
260
+ "use client";
261
+
262
+ import { SmartLoader } from "react-smart-loading-effects";
263
+
264
+ export default function Loading() {
265
+ return <SmartLoader type="dashboard" />;
266
+ }
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Accessibility
272
+
273
+ Built-in accessibility for screen readers and motion preferences:
274
+
275
+ - Loading root uses `role="status"`, `aria-busy="true"`, and `aria-label="Loading"`
276
+ - Decorative skeleton blocks are marked `aria-hidden="true"`
277
+ - Shimmer animation respects **`prefers-reduced-motion: reduce`** — users who prefer less motion see static skeletons automatically
278
+
279
+ ---
280
+
281
+ ## FAQ
282
+
283
+ ### What is a React skeleton loader?
284
+
285
+ A **skeleton loader** (or **skeleton screen**) is a placeholder UI that mimics the shape of content while data loads. Unlike spinners, skeletons reduce perceived wait time by showing users what is coming. `react-smart-loading-effects` provides pre-built skeleton layouts with shimmer animation.
286
+
287
+ ### How is this different from a spinner?
288
+
289
+ Spinners show activity but not structure. **Skeleton loaders** preview the actual layout — card images, table rows, dashboard charts — so users feel less disoriented during loading.
290
+
291
+ ### Do I need to import CSS?
292
+
293
+ No. Shimmer styles are injected once on first render. Zero extra setup.
294
+
295
+ ### Does it work with Next.js?
296
+
297
+ Yes. Use `SmartLoader` in client components (`"use client"`) or in loading.tsx files. No SSR issues — styles inject on the client.
298
+
299
+ ### Can I disable the shimmer animation?
300
+
301
+ Yes: `<SmartLoader type="card" animated={false} />`. Animation also auto-disables when the user has reduced motion enabled in their OS settings.
302
+
303
+ ### How big is the bundle?
304
+
305
+ Approximately **2.7 KB gzipped** (ESM). No runtime dependencies beyond React.
306
+
307
+ ### Can I use individual loader components?
308
+
309
+ Yes. Export `CardLoader`, `TableLoader`, `DashboardLoader`, `ProfileLoader`, `ListLoader`, `TextLoader`, and the base `Skeleton` primitive.
310
+
311
+ ---
312
+
313
+ ## Local demo
314
+
315
+ Preview all loaders with animation controls:
316
+
317
+ ```bash
318
+ npm run build
319
+ npm run demo
320
+ ```
321
+
322
+ Open [http://localhost:5174](http://localhost:5174).
323
+
324
+ ### Regenerate README GIFs
325
+
326
+ ```bash
327
+ npm run build
328
+ npm run demo # keep dev server running
329
+ npm run demo:gif # captures docs/*.gif via Playwright
330
+ ```
331
+
332
+ ---
333
+
334
+ ## License
335
+
336
+ MIT
@@ -0,0 +1,49 @@
1
+ import * as react from 'react';
2
+ import { CSSProperties } from 'react';
3
+
4
+ type LoaderType = "card" | "table" | "dashboard" | "profile" | "list" | "text";
5
+ interface SmartLoaderProps {
6
+ type: LoaderType;
7
+ rows?: number;
8
+ columns?: number;
9
+ animated?: boolean;
10
+ width?: number | string;
11
+ height?: number | string;
12
+ className?: string;
13
+ }
14
+ interface LoaderCommonProps {
15
+ rows?: number;
16
+ columns?: number;
17
+ animated?: boolean;
18
+ width?: number | string;
19
+ height?: number | string;
20
+ className?: string;
21
+ }
22
+
23
+ declare const SmartLoader: react.MemoExoticComponent<({ type, rows, columns, animated, width, height, className, }: SmartLoaderProps) => react.JSX.Element>;
24
+
25
+ declare const CardLoader: react.MemoExoticComponent<({ animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
26
+
27
+ declare const TableLoader: react.MemoExoticComponent<({ rows, columns, animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
28
+
29
+ declare const DashboardLoader: react.MemoExoticComponent<({ animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
30
+
31
+ declare const ProfileLoader: react.MemoExoticComponent<({ animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
32
+
33
+ declare const ListLoader: react.MemoExoticComponent<({ rows, animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
34
+
35
+ declare const TextLoader: react.MemoExoticComponent<({ rows, animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
36
+
37
+ interface SkeletonProps {
38
+ width?: number | string;
39
+ height?: number | string;
40
+ borderRadius?: number | string;
41
+ animated?: boolean;
42
+ className?: string;
43
+ style?: CSSProperties;
44
+ }
45
+ declare const Skeleton: react.MemoExoticComponent<({ width, height, borderRadius, animated, className, style, }: SkeletonProps) => react.JSX.Element>;
46
+
47
+ declare function useReducedMotion(): boolean;
48
+
49
+ export { CardLoader, DashboardLoader, ListLoader, type LoaderCommonProps, type LoaderType, ProfileLoader, Skeleton, type SkeletonProps, SmartLoader, type SmartLoaderProps, TableLoader, TextLoader, useReducedMotion };
@@ -0,0 +1,49 @@
1
+ import * as react from 'react';
2
+ import { CSSProperties } from 'react';
3
+
4
+ type LoaderType = "card" | "table" | "dashboard" | "profile" | "list" | "text";
5
+ interface SmartLoaderProps {
6
+ type: LoaderType;
7
+ rows?: number;
8
+ columns?: number;
9
+ animated?: boolean;
10
+ width?: number | string;
11
+ height?: number | string;
12
+ className?: string;
13
+ }
14
+ interface LoaderCommonProps {
15
+ rows?: number;
16
+ columns?: number;
17
+ animated?: boolean;
18
+ width?: number | string;
19
+ height?: number | string;
20
+ className?: string;
21
+ }
22
+
23
+ declare const SmartLoader: react.MemoExoticComponent<({ type, rows, columns, animated, width, height, className, }: SmartLoaderProps) => react.JSX.Element>;
24
+
25
+ declare const CardLoader: react.MemoExoticComponent<({ animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
26
+
27
+ declare const TableLoader: react.MemoExoticComponent<({ rows, columns, animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
28
+
29
+ declare const DashboardLoader: react.MemoExoticComponent<({ animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
30
+
31
+ declare const ProfileLoader: react.MemoExoticComponent<({ animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
32
+
33
+ declare const ListLoader: react.MemoExoticComponent<({ rows, animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
34
+
35
+ declare const TextLoader: react.MemoExoticComponent<({ rows, animated, width, height, className, }: LoaderCommonProps) => react.JSX.Element>;
36
+
37
+ interface SkeletonProps {
38
+ width?: number | string;
39
+ height?: number | string;
40
+ borderRadius?: number | string;
41
+ animated?: boolean;
42
+ className?: string;
43
+ style?: CSSProperties;
44
+ }
45
+ declare const Skeleton: react.MemoExoticComponent<({ width, height, borderRadius, animated, className, style, }: SkeletonProps) => react.JSX.Element>;
46
+
47
+ declare function useReducedMotion(): boolean;
48
+
49
+ export { CardLoader, DashboardLoader, ListLoader, type LoaderCommonProps, type LoaderType, ProfileLoader, Skeleton, type SkeletonProps, SmartLoader, type SmartLoaderProps, TableLoader, TextLoader, useReducedMotion };