BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ridiculous/keyframes-editor

Keyframes Editor

ridiculous/keyframes-editor
FreeComponent

Ridiculously typed editor for a CSS @keyframes body — the composition flagship. A two-level type validates each stop selector and dispatches every declaration into its property's own validator (transform, filter, color, easing, …). A timeline embeds the real editors per stop, with a scrubbed preview.

Install it

npx shadcn@latest add http://ridiculous.turtlesocks.dev/r/keyframes-editor.json

Source

src/components/ui/keyframes-editor/keyframes-editor.tsxridiculous.turtlesocks.dev/r/keyframes-editor.json · first 6 KB
1"use client"
2
3import { useEffect, useRef, useState } from "react"
4import { Button } from "@/components/ui/button"
5import {
6 Popover,
7 PopoverContent,
8 PopoverTrigger,
9} from "@/components/ui/popover"
10import { cn } from "@/lib/utils"
11import { DeclarationRow } from "./declaration-row"
12import { KeyframePreview } from "./keyframe-preview"
13import { KeyframeTimeline } from "./keyframe-timeline"
14import {
15 defaultKeyframes,
16 formatKeyframes,
17 parseKeyframes,
18 percentToSelector,
19 selectorToPercent,
20} from "./keyframes-editor.helpers"
21import type {
22 Declaration,
23 KeyframeBlock,
24 KeyframesString,
25} from "./keyframes-editor.types"
26
27// Re-export the public sub-components + their prop types so consumers (and the
28// barrel) can import them from `./keyframes-editor`.
29export type { DeclarationRowProps } from "./declaration-row"
30export { DeclarationRow } from "./declaration-row"
31export type { KeyframePreviewProps } from "./keyframe-preview"
32export { KeyframePreview } from "./keyframe-preview"
33export type { KeyframeTimelineProps } from "./keyframe-timeline"
34export { KeyframeTimeline } from "./keyframe-timeline"
35export type { MiniSelectProps } from "./mini-select"
36export { MiniSelect } from "./mini-select"
37
38// ---------------------------------------------------------------------------
39// Props
40// ---------------------------------------------------------------------------
41
42export interface KeyframesEditorPanelProps {
43 value: KeyframesString | (string & {})
44 onChange: (value: KeyframesString) => void
45 className?: string
46 "aria-label"?: string
47}
48
49export interface KeyframesEditorProps extends KeyframesEditorPanelProps {}
50
51// ---------------------------------------------------------------------------
52// KeyframesEditor — popover-wrapped
53// ---------------------------------------------------------------------------
54
55export function KeyframesEditor(props: KeyframesEditorProps) {
56 const {
57 value,
58 className,
59 "aria-label": ariaLabel = "Edit a CSS @keyframes body",
60 } = props
61 const { blocks, error } = parseKeyframes(String(value))
62 const label =
63 error !== null
64 ? "invalid"
65 : `${blocks.length} stop${blocks.length === 1 ? "" : "s"}`
66
67 return (
68 <Popover>
69 <PopoverTrigger asChild>
70 <Button
71 variant="outline"
72 className={cn("h-9 gap-2 px-3 font-mono", className)}
73 aria-label={ariaLabel}
74 >
75 <span aria-hidden="true" className="text-foreground/60">
76 ⏱
77 </span>
78// … truncated

What it pulls in

Other registry items

  • ridiculous-type-kit
  • transform-builder
  • filter-builder
  • color-picker
  • gradient-editor
  • easing-picker
  • unit-input
  • button
  • popover
  • input

Files it writes

  • src/components/ui/keyframes-editor/index.ts
  • src/components/ui/keyframes-editor/keyframes-editor.tsx
  • src/components/ui/keyframes-editor/keyframes-editor.types.ts
  • src/components/ui/keyframes-editor/keyframes-editor.helpers.ts
  • src/components/ui/keyframes-editor/keyframe-timeline.tsx
  • src/components/ui/keyframes-editor/declaration-row.tsx
  • src/components/ui/keyframes-editor/keyframe-preview.tsx
  • src/components/ui/keyframes-editor/mini-select.tsx

Facts

Registry
ridiculous
Type
registry:ui
Access
Free
Files written
8
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

ridiculous.turtlesocks.dev TurtIeSocks/ridiculous on GitHub Raw registry item This item as JSON

More from ridiculous

All 22 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
All ridiculous componentsallridiculousComponentsFreeno deps
Anchor Position Editoranchor-position-editorridiculousComponentsFreeno deps · 9 files
Background Editorbackground-editorridiculousComponentsFreeno deps · 9 files
Box Shadow Editorbox-shadow-editorridiculousComponentsFreeno deps · 7 files
Calc Editorcalc-editorridiculousComponentsFreeno deps · 4 files
Clip Path Editorclip-path-editorridiculousComponentsFreeno deps · 20 files
Color Functioncolor-functionridiculousComponentsFreeno deps · 10 files
Color Pickercolor-pickerridiculousComponentsFreeno deps · 11 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex