1.0.2 • Published 1 year ago

astro-textcircle v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

textcircle-min

Astro TextCircle

If you want to showcase your text in a circular layout, give this Astro component a try.

While this component isn't inherently responsive, you can easily create multiple circles that adjust to fit the viewport - just keep this in mind.

Live Demo

Instalation

using npm

npm install astro-textcircle

using pnpm

pnpm add astro-textcircle

Possible Props

If Visual Studio Code is your preferred IDE, simply press CRTL+SPACE / CMD+SPACE to reveal the valid properties.

PropertyObjectTypeDefaultDesctription
class-string-Add classes to the circle contaner
text-string-Shows the added text in a circular layout
spacingoptionsnumber1Spacing between the letters
textTransformoptionsstring-Will add text-transform with the given value
fontSizeInRemoptionsnumber1Will change the font-size to the given number in rem
fontWeightoptionsstring / numbernormalWill change the font-weight to the given value
divideroptionsstring-Change the spaces to the given value
dividerColoroptionsstring-Change the text color to the given color code
rotateoptionsnumber-Rotate the circle to the given value in deg
durationanimationstring-Change the animation speed
timinganimationstring-Animation timing function
delayanimationstring0sAnimation delay
directionanimationnormal / reversenormalAnimation rotation direction
countanimationinfinite / numberinfinitAnimation rotation count
animateOnHoveranimationbooleanfalseStart animation on mouse hover
stopAnimateOnHoveranimationbooleanfalseStop animation on hover

divider and dividerColor

Give your text a stylish twist with a divider instead of spacing - just use the divider property and set a custom color with dividerColor. Keep in mind that in order to use the dividerColor property, the divider property must be set beforehand.

animation

If you are using the animation property, you need to declare the duration poperty!

Keep in mind that using animateOnHover + stopAnimateOnHover will result in animateOnHover

How to use

---
import { TextCircle } from 'astro-textcircle';
---

<div>

  <!-- basic -->
  <TextCircle text="Display text in a circle" />

  <!-- using class with tailwind -->
  <Textcircle 
    text="Display text in a circle" 
    class="text-red-500 absolute top-8 left-8"
  />

  <!-- using options -->
  <TextCircle 
    text="Display text in a circle"
    options={{ 
      uppercase: true,
      fontSizeInRem: 0.75,
      fontWeight: 'bold',
      divider: '-',
      dividerColor: 'red',
      rotation: 45
    }}
  />

  <!-- using animation -->
  <TextCircle 
    text="Display text in a circle"
    animation={{ 
      duration: '12s',
      timing: 'linear',
      delay: '5s',
      direction: 'reverse',
      count: 'infinite',
      animateOnHover: true
    }}
  />

</div>

Notice that every letter and spacing in your text will be outputed as set:html={}

Using Slot

While slot can be used in this component, note that the height of the slot-container is dependent on the size of the text-circle.

  <TextCircle text="Display text in a circle">
    <img src="/my-image.jpg" alt="" />
  <TextCircle>

CSS Classes

<div class="lw-textcircle">
  <div class="lw-textcircle__inner">
    <p class="lw-textcircle-circle">
      Circle Text
    </p>
    <div class="lw-textcircle-slot">
      <slot />
    </div>
  </div>
</div>
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago