Being able to define custom props gives you powerful possibilities.
In this guide we will check how you can share/apply different styles by creating a
that you can apply to any UI element while your app is in loading state.
Usually the approach is to create a
Skeleton component, right?! CCSS's unique approach twists this logic:
Why just not being able to apply this style on any element?! With such approach you can apply
skeleton styles to any real and/or dummy content which will more accurately represent your final design/layout.
Create a custom prop
To register custom props you need to create your own CCSS instance first. For sake of simplicity we will
call our prop
We're creating a
valueMap for the property
styl where the values getting resolved as a CCSS object.
Of course, you're free to use your own handler function and handle the prop however you want.
We're simply creating a button which you can use to toggle a "loading state" on/off to render a skeleton UI.
Try it out
There is CodeSandbox based demo you can play with. It has slightly more styling/content.