Components
Animated chevrons icon that morphs between up and down directions on trigger.
Loading preview...
"use client"
import * as React from "react"
import { ChevronsUpDownIcon, type ChevronsUpDownIconHandle } from "@/components/ui/chevrons-up-down-icon"
export default function ChevronsUpDownIconDemo() {
const iconRef = React.useRef<ChevronsUpDownIconHandle>(null)
return (
<div className="flex min-h-52 w-full items-center justify-center">
<button
type="button"
className="flex size-16 items-center justify-center rounded-xl border bg-background text-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
onMouseEnter={() => iconRef.current?.startAnimation()}
onMouseLeave={() => iconRef.current?.stopAnimation()}
>
<ChevronsUpDownIcon ref={iconRef} className="size-6" />
</button>
</div>
)
}