1.0.5 • Published 6 months ago

react-spinning-border v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

React Spinning Border

react-spinning-border is a lightweight, customizable React component that creates a visually engaging, scroll-linked spinning border effect. Built with TypeScript, styled with TailwindCSS, and animated using Motion, it’s perfect for creating eye-catching avatar or profile image components.


Demo


Documentation

Explore the complete Storybook documentation for detailed usage, examples, and API reference:

View Storybook


Installation

Install the package via npm:

npm install react-spinning-border

SpinningBorder Component API

Prop NameTypeDefaultDescription
imagestringRequiredThe local or external image source. Must be a valid image URL or path. Typically a profile or avatar image.
colors[HexColor] \| [HexColor, HexColor] \| [HexColor, HexColor, HexColor] \| [HexColor, HexColor, HexColor, HexColor]['#f137a6', '#fbe932', '#5c9eff', '#7ed21e']An optional array of hex color strings to customize border gradients. Must be 1 to 4 valid hex colors.
size'sm' \| 'md' \| 'lg' \| 'xl' \| 'full''md'The overall size of the component. Options: 'sm' (96x96px), 'md' (192x192px), 'lg' (320x320px), etc.
border'sm' \| 'md' \| 'lg' \| 'xl''md'The size of the border around the image. Options: 'sm' (3%), 'md' (5%), 'lg' (7%), 'xl' (8%).
padding'sm' \| 'md' \| 'lg' \| 'none''md'The size of the gap between the border and the image. Options: 'sm' (2%), 'md' (3%), 'lg' (7%), etc.
speedFactornumber1A number used to speed up or slow down the spin animation. Recommended range: 0 to 10.
classNamestringundefinedAdditional CSS classes for custom styling.
...restReact.HTMLAttributes<HTMLDivElement>undefinedAny additional HTML attributes to be passed to the component's container.

Examples

Basic Usage

<SpinningBorder
  image="https://example.com/profile.jpg"
  size="lg"
  border="xl"
  colors={['#ff0000', '#00ff00', '#0000ff']}
/>

Custom Speed and Padding

<SpinningBorder
  image="/assets/avatar.png"
  size="md"
  border="lg"
  padding="sm"
  speedFactor={2}
  colors={['#e63946', '#f1faee']}
/>

Links

Author

This package was created and maintained by Seth Way.

License

This project is licensed under the MIT License.