Hero

Description

The Hero component is a full-width, visually striking section typically used at the top of a page. It combines a background image or video with customizable content, offering flexible alignment and padding options. The component includes parallax-like effects and responsive design, creating an engaging and immersive user experience.

Installation

bash
sabaccui add hero

Usage

Preview

Beautiful landscape

Welcome to Our Site

Discover amazing content and experience

Schema

Field NameTypeDescriptionDefault
contentbloksNested components for the hero content-
imageassetBackground image or video (required)-
alignoptionHorizontal alignment of content (left, center, right)left
valignoptionVertical alignment of content (start, center, end)end
paddingoptionPadding size (lg, xl)lg

Notes

  1. The component uses the useElementBounding and usePreferredReducedMotion composables from the @vueuse/core library for scroll-based effects and accessibility.
  2. A parallax-like effect is applied to the background image, which scales slightly as the user scrolls.
  3. The component supports both image and video backgrounds, automatically detecting the file type.
  4. Responsive image sources are provided for different screen sizes.
  5. An overlay with adjustable opacity is applied to enhance content visibility.
  6. The component is designed to be full-width and takes up the full height of the viewport.

Best Practices:

  • Choose high-quality, visually appealing images or videos that complement your content.
  • Ensure sufficient contrast between the background and text for readability.
  • Keep the content concise and impactful to maintain the user's attention.
  • Consider using a video background sparingly, as it can impact page load times and may not be suitable for all users or devices.
  • Test the component across various devices and screen sizes to ensure a consistent experience.