UI Blur In
remocn/blur-inFreeComponent
A wrapper that reveals a single child with blur + opacity + a directional offset; a pure state atom, theme-independent — its context is a motion config (blur/distance/axis), not a theme.
Install it
npx shadcn@latest add https://www.remocn.dev/r/blur-in.jsonSource
1"use client";23import type { CSSProperties, ReactNode } from "react";45export type BlurInState = "hidden" | "revealed";6export type BlurInDirection = "up" | "down" | "left" | "right";78export interface BlurInStyle {9 blur: number;10 opacity: number;11 translateX: number;12 translateY: number;13}1415export interface BlurInStyleContext {16 blur: number;17 distance: number;18 axis: "x" | "y";19 sign: 1 | -1;20}2122export function blurInStyleContext(23 blur: number,24 direction: BlurInDirection,25 distance: number,26): BlurInStyleContext {27 const axis: "x" | "y" =28 direction === "left" || direction === "right" ? "x" : "y";29 const sign: 1 | -1 = direction === "up" || direction === "left" ? 1 : -1;30 return { blur, distance, axis, sign };31}3233export function blurInStyle(34 state: BlurInState,35 ctx: BlurInStyleContext,36): BlurInStyle {37 if (state === "revealed")38 return { blur: 0, opacity: 1, translateX: 0, translateY: 0 };39 return {40 blur: ctx.blur,41 opacity: 0,42 translateX: ctx.axis === "x" ? ctx.sign * ctx.distance : 0,43 translateY: ctx.axis === "y" ? ctx.sign * ctx.distance : 0,44 };45}4647export interface BlurInProps {48 state?: BlurInState;49 style?: BlurInStyle;50 children: ReactNode;51 blur?: number;52 direction?: BlurInDirection;53 distance?: number;54 display?: CSSProperties["display"];55 className?: string;56}5758export function BlurIn({59 state = "hidden",60 style,61 children,62 blur = 8,63 direction = "up",64 distance = 12,65 display = "inline-block",66 className,67}: BlurInProps) {68 const v =69 style ?? blurInStyle(state, blurInStyleContext(blur, direction, distance));70 return (71 <div72 className={className}73 style={{74 display,75 opacity: v.opacity,76 filter: v.blur > 0 ? `blur(${v.blur}px)` : "none",77 transform: `translate(${v.translateX}px, ${v.translateY}px)`,78 }}79 >80 {children}81 </div>82 );83}
What it pulls in
npm packages
Other registry items
Files it writes
More from remocn
All 282 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| UI Accordionaccordion | remocn | Components | Free | 1 dep · 2 files | |
| UI AI Prompt Flowai-prompt-flow | remocn | Components | Free | 1 dep | |
| UI Alert Dialogalert-dialog | remocn | Components | Free | 1 dep · 2 files | |
| Animated Bar Chartanimated-bar-chart | remocn | Components | Free | 1 dep | |
| Animated Line Chartanimated-line-chart | remocn | Components | Free | 1 dep | |
| ASCII Dissolveascii-dissolve | remocn | Components | Free | 2 deps | |
| ASCII Renderascii-render | remocn | Components | Free | 1 dep | |
| Backdropbackdrop | remocn | Components | Free | 1 dep |
