BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ridiculous/property-syntax-editor

@property Syntax Editor

ridiculous/property-syntax-editor
FreeComponent

Ridiculously typed editor for the CSS @property syntax: descriptor. The namesake types one CSS string with another — InitialValueLiteral<Syntax, V> checks an initial-value against the validated syntax, so cssProperty("<length>", "red") is a compile error. A chip builder sits beside a live green/red demo.

Install it

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

Source

src/components/ui/property-syntax-editor/property-syntax-editor.tsxridiculous.turtlesocks.dev/r/property-syntax-editor.json
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 { InitialValueField } from "./initial-value-field"
12import {
13 defaultInitialValue,
14 formatSyntax,
15 parseSyntax,
16} from "./property-syntax-editor.helpers"
17import type {
18 PropertySyntaxState,
19 SyntaxString,
20} from "./property-syntax-editor.types"
21import { SyntaxChipBuilder } from "./syntax-chip-builder"
22
23// Re-export the public sub-components + their prop types so consumers (and the
24// barrel) can import them from `./property-syntax-editor`.
25export type { InitialValueFieldProps } from "./initial-value-field"
26export { InitialValueField } from "./initial-value-field"
27export type { MiniSelectProps } from "./mini-select"
28export { MiniSelect } from "./mini-select"
29export type { SyntaxChipBuilderProps } from "./syntax-chip-builder"
30export { SyntaxChipBuilder } from "./syntax-chip-builder"
31
32// ---------------------------------------------------------------------------
33// value string ⇄ editor state
34// ---------------------------------------------------------------------------
35
36function deriveState(
37 value: string,
38 prev?: PropertySyntaxState,
39): PropertySyntaxState {
40 const { universal, components } = parseSyntax(value)
41 return {
42 universal,
43 components,
44 initialValue: prev?.initialValue ?? defaultInitialValue(value),
45 inherits: prev?.inherits ?? false,
46 }
47}
48
49// ---------------------------------------------------------------------------
50// Props
51// ---------------------------------------------------------------------------
52
53export interface PropertySyntaxEditorPanelProps {
54 value: SyntaxString | (string & {})
55 onChange: (value: SyntaxString) => void
56 className?: string
57 "aria-label"?: string
58}
59
60export interface PropertySyntaxEditorProps
61 extends PropertySyntaxEditorPanelProps {}
62
63// ---------------------------------------------------------------------------
64// PropertySyntaxEditor — popover-wrapped
65// ---------------------------------------------------------------------------
66
67export function PropertySyntaxEditor(props: PropertySyntaxEditorProps) {
68 const {
69 value,
70 className,
71 "aria-label": ariaLabel = "Edit a CSS @property syntax descriptor",
72 } = props
73
74 return (
75 <Popover>
76 <PopoverTrigger asChild>
77 <Button
78 variant="outline"
79// … truncated

What it pulls in

Other registry items

  • ridiculous-type-kit
  • color-picker
  • button
  • popover
  • input

Files it writes

  • src/components/ui/property-syntax-editor/index.ts
  • src/components/ui/property-syntax-editor/property-syntax-editor.tsx
  • src/components/ui/property-syntax-editor/property-syntax-editor.types.ts
  • src/components/ui/property-syntax-editor/property-syntax-editor.helpers.ts
  • src/components/ui/property-syntax-editor/syntax-chip-builder.tsx
  • src/components/ui/property-syntax-editor/initial-value-field.tsx
  • src/components/ui/property-syntax-editor/mini-select.tsx

Facts

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

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