Skip to main content

Skeleton

The atomic Skeleton component is a helper component that allows you to display a loading animation while the content is loading. This component is particularly useful when you need to display a loading animation while the content is loading by presenting a placeholder UI of all the components to the user.

Usage​

import { AssetByVariant, IconByVariant, Skeleton } from '@/components/atoms';

function Example() {
const fetchOneUserQuery = useFetchOneQuery(currentId); // fetchOneUserQuery is a react-query query

return (
<Skeleton
loading={fetchOneUserQuery.isLoading}
>
<Text>{user.name}</Text>
</Skeleton>
);
}

export default Example;

So the user name will be displayed when the fetchOneUserQuery is not loading, otherwise, the Skeleton component will display a loading animation.

Props​

NameTypeDefaultDescription
loadingbooleanThe required boolean value to determine whether the content is loading or not.
childrenReactNodeThe required children to be displayed.
heightDimensionValue24The duration of the loading animation in milliseconds.
widthDimensionValue'100%'The duration of the loading animation in milliseconds.
...propsViewPropsall props from View component are supported.