Inline Highlight
framecn/inline-highlightFreeComponent
Animates one word inside a sentence from a base color to a brand color.
Install it
npx shadcn@latest add https://framecn.dev/r/inline-highlight.jsonSource
1"use client";23import { Timegroup } from "@editframe/react";4import type { CSSProperties } from "react";56export interface InlineHighlightProps {7 before: string;8 highlight: string;9 after?: string;10 baseColor?: string;11 highlightColor?: string;12 fontSize?: number;13 fontWeight?: number;14 speed?: number;15 fps?: number;16 durationInFrames?: number;17 background?: string;18 className?: string;19}2021export const InlineHighlight = ({22 before,23 highlight,24 after = "",25 baseColor = "#171717",26 highlightColor = "#ff5e3a",27 fontSize = 48,28 fontWeight = 600,29 speed = 1,30 fps = 30,31 durationInFrames = 90,32 background = "white",33 className,34}: InlineHighlightProps) => {35 const safeSpeed = Math.max(0.01, speed);36 const durationMs = (durationInFrames / fps) * 1000;37 const highlightDurationMs =38 (((durationInFrames * 0.5) / fps) * 1000) / safeSpeed;3940 const containerStyle: CSSProperties = {41 alignItems: "center",42 background,43 display: "flex",44 height: 500,45 justifyContent: "center",46 position: "relative",47 width: 1000,48 };4950 return (51 <Timegroup52 className={className}53 duration={`${durationMs}ms`}54 mode="fixed"55 style={containerStyle}56 >57 <>58 <style>{`59 @keyframes framecn-inline-highlight {60 from {61 color: ${baseColor};62 }63 to {64 color: ${highlightColor};65 }66 }67 `}</style>68 <span69 style={{70 animation: `framecn-inline-highlight ${highlightDurationMs}ms ease-out ${durationMs - highlightDurationMs}ms forwards`,71 fontFamily:72 "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",73 fontSize,74 fontWeight,75 letterSpacing: "-0.03em",76 }}77 >78 {before}79 <span style={{ color: highlightColor }}>{highlight}</span>80 {after}81 </span>82 </>83 </Timegroup>84 );85};
What it pulls in
npm packages
Files it writes
More from framecn
All 101 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Generate Overlayai-generate-overlay | framecn | Components | Free | 1 dep | |
| AI Generation Canvasai-generation-canvas | framecn | Components | Free | 1 dep | |
| Animated Bar Chartanimated-bar-chart | framecn | Components | Free | 1 dep | |
| Animated Line Chartanimated-line-chart | framecn | Components | Free | 1 dep | |
| Backdropbackdrop | framecn | Components | Free | 1 dep | |
| Blur Out Upblur-out-up | framecn | Components | Free | 1 dep | |
| Blur Revealblur-reveal | framecn | Components | Free | 1 dep | |
| Bounding Box Selectorbounding-box-selector | framecn | Components | Free | 1 dep |
