Skip to Content

Loading

A simple spinning loader animation. Use it as a visual indicator while content loads or during processing.

import { Loading } from '@appfunnel-dev/sdk/elements' // Basic — inherits color from parent text color <Loading /> // Custom color and size <Loading color="#2563EB" size="lg" /> // Custom pixel size and speed <Loading customSize={24} borderWidth={2} color="#fff" speed={600} />

Props

PropTypeDefaultDescription
colorstringcurrentColorSpinner color. Inherits from parent if not set
size'xs' | 'sm' | 'md' | 'lg' | 'xl''md'Predefined size preset
customSizenumberCustom size in pixels (overrides size preset)
borderWidthnumberCustom border width in pixels (overrides size preset)
speednumber800Animation speed in milliseconds
classNamestringAdditional CSS class name
styleCSSPropertiesAdditional inline styles

Size presets

SizeDimensionsBorder
xs20px2px
sm30px3px
md40px3px
lg50px4px
xl60px4px

Usage in buttons

A common pattern is showing a spinner inside a button during async operations:

import { usePayment } from '@appfunnel-dev/sdk' import { Loading, motion } from '@appfunnel-dev/sdk/elements' function PayButton() { const { loading } = usePayment() return ( <motion.button whileTap={!loading ? { scale: 0.95 } : {}} disabled={loading} className="w-full py-4 bg-blue-600 text-white font-bold rounded-2xl" > {loading ? <Loading size="xs" color="#fff" /> : 'Pay now'} </motion.button> ) }
Last updated on