BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/Iconiq UI/code-block

Code Block

iconiq-ui/code-block
FreeComponent

Editor-style code block with a filename tab, a top-right spring-crossfade copy button, a bottom status bar with language and line count, line numbers, built-in theme-aware syntax highlighting, and line emphasis.

Live preview

live · rendered by the registry
Rendered by Iconiq UI on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.iconiqui.com/r/code-block.json

Source

code-block.tsxwww.iconiqui.com/r/code-block.json · first 6 KB
1"use client";
2
3import { Check, Copy } from "lucide-react";
4import { AnimatePresence, motion, useReducedMotion } from "motion/react";
5import { useCallback, useMemo, useRef, useState } from "react";
6
7import { cn } from "@/lib/utils";
8
9const COPY_RESET_MS = 2000;
10
11/** Transform-only spring for the copy icon swap — stays off the layout thread. */
12const ICON_SPRING = {
13 type: "spring",
14 stiffness: 600,
15 damping: 30,
16 mass: 0.6,
17} as const;
18
19type TokenKind =
20 | "call"
21 | "comment"
22 | "keyword"
23 | "number"
24 | "operator"
25 | "plain"
26 | "property"
27 | "punctuation"
28 | "string"
29 | "tag"
30 | "type";
31
32type Token = {
33 kind: TokenKind;
34 value: string;
35};
36
37const KEYWORDS = new Set([
38 "abstract",
39 "as",
40 "async",
41 "await",
42 "break",
43 "case",
44 "catch",
45 "class",
46 "const",
47 "continue",
48 "def",
49 "default",
50 "delete",
51 "do",
52 "elif",
53 "else",
54 "enum",
55 "export",
56 "extends",
57 "false",
58 "finally",
59 "fn",
60 "for",
61 "from",
62 "function",
63 "if",
64 "implements",
65 "import",
66 "in",
67 "instanceof",
68 "interface",
69 "let",
70 "match",
71 "new",
72 "None",
73 "not",
74 "null",
75 "of",
76 "pass",
77 "private",
78 "protected",
79 "public",
80 "readonly",
81 "return",
82 "satisfies",
83 "static",
84 "struct",
85 "switch",
86 "this",
87 "throw",
88 "true",
89 "try",
90 "type",
91 "typeof",
92 "undefined",
93 "var",
94 "void",
95 "while",
96 "yield",
97]);
98
99const WHITESPACE_RE = /^\s+/;
100const BLOCK_COMMENT_RE = /^\/\*[\s\S]*?(?:\*\/|$)/;
101const LINE_COMMENT_RE = /^(?:\/\/|#)[^\n]*/;
102const TEMPLATE_STRING_RE = /^`(?:\\.|[\s\S])*?`/;
103const DOUBLE_QUOTED_STRING_RE = /^"(?:\\.|[^"\\])*"/;
104const SINGLE_QUOTED_STRING_RE = /^'(?:\\.|[^'\\])*'/;
105const TAG_RE = /^<\/?[A-Za-z][\w.-]*|^\/?>/;
106const ATTRIBUTE_RE = /^[A-Za-z_$][\w$-]*(?==)/;
107const PROPERTY_RE = /^[A-Za-z_$][\w$-]*(?=\s*:)/;
108const IDENTIFIER_RE = /^[A-Za-z_$][\w$]*/;
109const TYPE_IDENTIFIER_RE = /^[A-Z]/;
110const NUMBER_RE = /^-?\d+(?:\.\d+)?/;
111const OPERATOR_RE =
112 /^(?:=>|===|!==|==|!=|<=|>=|\+\+|--|\|\||&&|\?\?|\.\.\.|[=<>+\-*/%!?&|])/;
113const PUNCTUATION_RE = /^[{}()[\],.;:]/;
114
115const STATIC_MATCHERS: { kind: TokenKind; regex: RegExp }[] = [
116 { kind: "plain", regex: WHITESPACE_RE },
117 { kind: "comment", regex: BLOCK_COMMENT_RE },
118 { kind: "comment", regex: LINE_COMMENT_RE },
119 { kind: "string", regex: TEMPLATE_STRING_RE },
120 { kind: "string", regex: DOUBLE_QUOTED_STRING_RE },
121 { kind: "string", regex: SINGLE_QUOTED_STRING_RE },
122 { kind: "tag", regex: TAG_RE },
123 { kind: "property", regex: ATTRIBUTE_RE },
124// … truncated

What it pulls in

npm packages

  • motion
  • lucide-react

Files it writes

  • code-block.tsx

Facts

Registry
Iconiq UI
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

Docs on Iconiq UI www.iconiqui.com edwinvakayil/iconiq on GitHub Raw registry item This item as JSON

More from Iconiq UI

All 119 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionIconiq UIComponentsFree2 deps
AI Inputai-inputIconiq UIComponentsFree3 deps
AlertalertIconiq UIComponentsFree2 deps
AvataravatarIconiq UIComponentsFree3 deps
Accordion (Base UI)b-accordionIconiq UIComponentsFree2 deps
Alert Dialog (Base UI)b-alert-dialogIconiq UIComponentsFree3 deps
Autocomplete (Base UI)b-autocompleteIconiq UIComponentsFree3 deps
Avatar (Base UI)b-avatarIconiq UIComponentsFree2 deps
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