Add Copyable component to the registry#3
Open
calebpanza wants to merge 1 commit into
Open
Conversation
A card-styled surface that displays a value next to a button that copies it to the clipboard and confirms with a check. Ships base + radix variants (no primitive dependency, so they're byte-identical), cn-copyable-* style tokens across all 8 styles, a showcase demo, and built registry-dist items. CUI-2
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assignee: Caleb Panza
Summary
Adds a standalone Copyable component to the Crescent UI shadcn registry — a card-styled surface that displays a value alongside a button that copies it to the clipboard and confirms with a check.
Built as a namespaced compound component, following the existing
choiceboxconventions:Copyable(root) — holds thevalue, runs the Clipboard write, and exposescopied/copyvia context. Props:value(required),timeout(ms before the confirmation resets, default 2000),onCopy.CopyableContent— the visualization slot (the displayed value can differ from what's copied — e.g. a masked key).CopyableButton— the copy button; swaps a copy → check glyph (viaIconPlaceholder, so it's icon-library agnostic) and exposesdata-copiedfor styling.What's included
registry/bases/base/ui/copyable.tsx+registry/bases/radix/ui/copyable.tsx. Copyable has no Base UI / Radix primitive dependency (just structural markup + the Clipboard API), so the two variants are byte-identical and kept only so each project base can install it from its namespace.cn-copyable,cn-copyable-content,cn-copyable-buttonadded to all 8 styles (vega, nova, maia, lyra, mira, luma, sera, rhea), each matching that style's radius/temperament (e.g. Sera's button inverts to a solid foreground block on copy).registry.jsonandscripts/build-registry.ts; built artifacts inregistry-dist/{base,radix}-*/copyable.json.app/showcase/components/copyable-demo.tsx(preview + "secret value" and "custom content" examples), wired intodemos.tsx.Testing
bun run registry:build→ 32 items, no unresolvedcn-*tokensbun run typecheck✓ ·bun run lint✓ ·bun run build✓data-copiedand shows the check confirmation.Note on the reference
The issue pointed to a reference in the local (uncommitted)
post-for-me-dashboarddirectory, noting it "still needs to be reviewed." That directory is outside this session's permitted paths, so I couldn't read it — this implementation was built fresh against the registry's establishedchoiceboxconventions. Happy to reconcile against the reference if there are specific behaviors it should match.Closes CUI-2