https://cezarsmpio.github.io/react-fake-content/
npm install react-fake-content --save
π React 16.8+ is required. This library uses React Hooks.
import { Circle } from 'react-fake-content';
function Avatar(props) {
if (!props.loaded) {
return <Circle size="40px" />
}
return <img src={props.url} width="40" height="40">
}
β All components support server-side rendering!
import { Rectangle } from 'react-fake-content';
function Component(props) {
return <Rectangle width="400px" height="250px" />;
}
CSS unit to define the widht of the component.
CSS unit to define the height of the component.
import { Circle } from 'react-fake-content';
function Component(props) {
return <Circle size="25px" />;
}
CSS unit to define either width and height of the component.
import { Line } from 'react-fake-content';
function Component(props) {
return (
<CodeBlock>
<Line width="100%" height="12px" />
<Line width="95%" height="12px" />
<Line width="98%" height="12px" />
<Line width="100%" height="12px" />
<Line width="92%" height="12px" />
</CodeBlock>
);
}
CSS unit to define width of the component.
CSS unit to define height of the component.
import { Square } from 'react-fake-content';
function Component(props) {
return <Square size="45px" />;
}
CSS unit to define either width and height of the component.
All properties below are applicable for all components.
false
to disable animation.
Number in miliseconds.
CSS animation name.
CSS unit to define the primary color of the component gradient.
CSS unit to define the secondary color of the component gradient.
A list of CSS properties to be added into the component.
Changes the component element to be rendered.
The component will adapt to its container size if the value is true
. Otherwise, it won't resize itself.
By default, all components are block
. If you want them rendered as inline-block
, use inline={true}
or style={{ display: 'inline-block' }}
.
- Chrome β
- Firefox β
- Safari β
- Opera β
- Edge 15+ β
- IE11+ β
- iOS 9+ β
- Android 5+ β
Including animations!