Refined UI

An opinionated, customizable superset of shadcn/ui

AgentsPrimitivesSkillsSkins
Guides
  • Overview
  • Get started
  • Shadcn compatibility
  • Architecture
  • Agent surface
Primitives
  • Accordion
  • Alert
  • Alert dialog
  • Aspect ratio
  • Autocomplete
  • Avatar
  • Badge
  • Button
  • Button group
  • Calendar
  • Card
  • Checkbox
  • Checkbox Group
  • Code
  • Code Diff
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Date Picker
  • Dialog
  • Drawer
  • Empty
  • Field
  • Form
  • Gradient Editor
  • Hover card
  • Input
  • Input group
  • Input OTP
  • Item
  • Kbd
  • Markdown
  • Menu
  • Menubar
  • Meter
  • Native select
  • Navigation menu
  • Number Field
  • Pagination
  • Popover
  • Progress
  • Radio group
  • Resizable
  • Scroll area
  • Select
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Table
  • Table of contents
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • Toolbar
  • Tooltip
  • Tree
  • Trigger Menu
  • Typography
Hooks
  • Use Chat Message
  • Use Chat Input
  • Use User Ask
  • Use Audio Recorder
  • Use Environment Variables
  • Use Copy To Clipboard
  • Use Tool Call
  • Use Sidebar Resize
Utils
  • cn
  • Skin
  • Contracts
  • Serialize
Extensions
  • Control Effects
  • View Transition
  • Send Aurora
  1. Primitives
  2. Code
Primitives

Code

Shared code surface: Shiki-highlighted lines, gutter, clean copy, and virtualization for large files.

Examples

Headerless copy

Use an icon copy action when the filename row would add noise.

Composition

The preferred shape for composing the installed primitive from its exported parts.

Parts

Exported compound parts from the installed source.

Code
├── CodeHeader
├── CodeTitle
├── CodeActions
├── CodeCopy
├── CodeFloatingCopy
├── CodeTokenLine
└── CodeContent

The refined source installs this primitive from src/registry/sources/refined/ui/code.tsx. Install it on its own with the command above, or inspect the source below.

Registry command
npx shadcn@latest add http://127.0.0.1:3000/r/refined/code.json
See registry manifest

Installed dependencies

Installed with this primitive because the slot depends on them; they are support files, not standalone sidebar items.

Button slotsrc/registry/sources/refined/ui/button.tsxSkin
Tooltip slotsrc/registry/sources/refined/ui/tooltip.tsxSkin
Shiki tokenizersrc/registry/lib/code-tokens.tsSupport
Code + diff tokenssrc/registry/sources/refined/code.cssSupport

Raw code

Primary installed primitive source

Code slot
src/registry/sources/refined/ui/code.tsx

On this page

  • Preview
  • Examples
  • Composition
  • Installation
  • Dependencies
  • Source
counter.tsx
1import { useState } from "react";
2​
3export function Counter({ start = 0 }: { start?: number }) {
4 const [count, setCount] = useState(start);
5 return <button onClick={() => setCount((n) => n + 1)}>{count}</button>;
6}
const steps = [
"Read registry metadata",
"Install owned source",
"Customize in place",
];
​
export function installSummary() {
return steps.join(" -> ");
}