For Tailwind CSS v3 docs, click here.

走马灯

A customizable scrolling component that loops its content horizontally or vertically, with configurable direction, hover pause, and repeat options.

通过 CLI 安装

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/marquee.json"

手动安装

在同一个文件中,复制并粘贴以下代码:

Marquee.vue
ReviewCard.vue

API

Prop 名称类型默认值描述
classstring''Custom CSS classes to apply to the outermost container of the marquee.
reversebooleanfalseSets the scrolling direction to reverse (right to left or bottom to top).
pauseOnHoverbooleanfalsePauses the marquee animation when hovered.
verticalbooleanfalseSets the scrolling direction to vertical instead of horizontal.
repeatnumber4Number of times the content inside the marquee should be repeated.

功能特性

  • Horizontal & Vertical Scrolling: You can scroll the content horizontally (default) or vertically with the vertical prop.
  • Reverse Direction: Enable reverse scrolling for dynamic effects using the reverse prop.
  • Pause on Hover: Pauses the scrolling animation when the user hovers over the marquee.
  • Content Repetition: The repeat prop controls how many times the content inside the marquee will loop.
  • Custom Duration and Gap: You can control the animation duration and gap between the repeated items using CSS variables --duration and --gap.

CSS Variables

You can customize the speed and gap between the items by setting the following CSS variables:

  • --duration: Controls the speed of the marquee animation.
  • --gap: Sets the space between repeated items in the marquee.

功能特性

  • Fully Customizable: Easily adjust the duration, gap, direction, and hover behavior to suit your needs.
  • Smooth Transitions: The component uses CSS keyframes to achieve smooth scrolling and transitions.
  • Multi-Directional: Scroll content either horizontally or vertically with a simple prop change.
  • Content Flexibility: Place any Vue components or HTML elements inside the marquee slot for dynamic content scrolling.

感谢