BloksAtomMorphHeadline

MorphHeadline

Description

The MorphHeadline component is a versatile and engaging text display element that animates between multiple text variants. It's designed to create eye-catching headlines that smoothly transition between different phrases, maintaining common text elements while changing others. This component is ideal for landing pages, hero sections, or any area where you want to draw attention to multiple related messages.

Installation

bash
sabaccui add morphHeadline

Usage

Here are examples of how to use the MorphHeadline component in a Storyblok block:

Second part is morphing and not repeating

Preview

SabaccUI DeliversSeamless Integration with Nuxt

First part is morphing and repeating

Preview

Transform Your Web Projectswith SabaccUI

Complete change of text

Preview

Code Less, Create More

Schema

FieldTypeDescriptionDefault
texttextareaThe text content for the headline. Each line represents a different variant that will be morphed.-
leveloptionThe HTML heading level (h1, h2, h3, h4).h2
sizeoptionThe text size class (9xl, 7xl, 5xl, 3xl, xl, lg, sm).-
coloroptionThe text color (primary, secondary, dark, light, white, black).-
weightoptionThe font weight (bold, semibold, light).-
intervalnumberThe time interval (in milliseconds) between text transitions.1000
repeatDelaynumberThe delay (in milliseconds) before repeating the animation cycle.-

None specified.

Notes

  1. The component uses Vue 3's Composition API with <script setup> for improved performance and maintainability.
  2. Text transitions are handled using Vue's built-in <transition-group> component for smooth animations.
  3. The component automatically detects common substrings across variants to keep them static during transitions.
  4. Tailwind CSS classes are used for styling, making it easy to customize the appearance.

Best Practices:

  • Keep the number of text variants (lines in the text field) reasonable to ensure smooth performance.
  • Use concise phrases that share common words or structure for the best morphing effect.
  • Adjust the interval and repeatDelay to find the right balance between readability and engagement.
  • Consider the context where the MorphHeadline will be used and choose appropriate size and color options to match your design.
  • Test the component at different screen sizes to ensure readability across devices.