chevrons-up-down-icon
ncdai/chevrons-up-down-iconUnverifiedComponent
Animated chevrons icon that morphs between up and down directions.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/exekartik/exeKartik/main/chevrons-up-down-icon.jsonSource
1"use client"23import { useImperativeHandle } from "react"4import { motion, useAnimation } from "motion/react"56export type ChevronsUpDownIconHandle = {7 startAnimation: () => void8 stopAnimation: () => void9}1011export type ChevronsUpDownIconProps = React.ComponentPropsWithoutRef<"svg"> & {12 ref?: React.Ref<ChevronsUpDownIconHandle>13 duration?: number14}1516export function ChevronsUpDownIcon({17 ref,18 duration = 0.3,19 ...props20}: ChevronsUpDownIconProps) {21 const controls = useAnimation()2223 useImperativeHandle(ref, () => {24 return {25 startAnimation: () => controls.start("animate"),26 stopAnimation: () => controls.start("normal"),27 }28 })2930 return (31 <svg32 xmlns="http://www.w3.org/2000/svg"33 width="24"34 height="24"35 viewBox="0 0 24 24"36 fill="none"37 stroke="currentColor"38 strokeWidth="2"39 strokeLinecap="round"40 strokeLinejoin="round"41 aria-hidden42 {...props}43 >44 <motion.path45 d="M7 15L12 20L17 15"46 variants={{47 normal: {48 d: "M7 15L12 20L17 15",49 },50 animate: {51 d: "M7 20L12 15L17 20",52 },53 }}54 initial="normal"55 animate={controls}56 transition={{57 duration,58 }}59 />60 <motion.path61 d="M7 9L12 4L17 9"62 variants={{63 normal: {64 d: "M7 9L12 4L17 9",65 },66 animate: {67 d: "M7 4L12 9L17 4",68 },69 }}70 initial="normal"71 animate={controls}72 transition={{73 duration,74 }}75 />76 </svg>77 )78}
What it pulls in
npm packages
Files it writes
More from ncdai
All 17 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Apple Hello Effectapple-hello-effect | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Hindiapple-hello-effect-hindi | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Spanishapple-hello-effect-spanish | ncdai | Components | Unverified | 1 dep | |
| Apple Hello Effect - Vietnameseapple-hello-effect-vietnamese | ncdai | Components | Unverified | 1 dep | |
| Brand Assets Menubrand-assets-menu | ncdai | Components | Unverified | 1 dep | |
| Code Block Commandcode-block-command | ncdai | Components | Unverified | 4 deps · 3 files | |
| Consent Managerconsent-manager | ncdai | Components | Unverified | 1 dep · 2 files | |
| Contribution Graphcontribution-graph | ncdai | Components | Unverified | 1 dep |
