File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ return (
109
109
<tr>
110
110
<td><code>count?: number</code></td>
111
111
<td>
112
- The number of lines of skeletons to render. If
112
+ The number of lines of skeletons to render. If
113
113
<code>count</code> is a decimal number like 3.5,
114
114
three full skeletons and one half-width skeleton will be
115
115
rendered.
@@ -273,6 +273,29 @@ const wrapped2 = (
273
273
);
274
274
```
275
275
276
+ ## Troubleshooting
277
+
278
+ ### The skeleton width is 0 when the parent has ` display: flex ` !
279
+
280
+ In the example below, the width of the skeleton will be 0:
281
+
282
+ ``` tsx
283
+ <div style = { { display: ' flex' }} >
284
+ <Skeleton />
285
+ </div >
286
+ ```
287
+
288
+ This happens because the skeleton has no intrinsic width. You can fix it by
289
+ applying ` flex: 1 ` to the skeleton container via the ` containerClassName ` prop.
290
+
291
+ For example, if you are using Tailwind, your code would look like this:
292
+
293
+ ``` tsx
294
+ <div style = { { display: ' flex' }} >
295
+ <Skeleton containerClassName = " flex-1" />
296
+ </div >
297
+ ```
298
+
276
299
### The height of my container is off by a few pixels!
277
300
278
301
In the example below, the height of the ` <div> ` will be slightly larger than 30
You can’t perform that action at this time.
0 commit comments