Skip to content
Chat & AI

Ai Code Block

Compound code surface for tool output and streamed files.

Import

tsx
import { AiCodeBlock } from "@cronus-ui/ui";
bash
npx cronus-ui add ai-code-block

Examples

.cronus

No audit fixture declares this family in .cronus yet.

React onlyParity: Not portedParity scoreboard

API Reference

Generated from the component's exported types.

AiCodeBlockLabels

Skip AiCodeBlockLabels props table
PropTypeDefaultDescription
copy
string——
copied
string——
selectFile
string——

AiCodeBlockProps

Extends HTMLAttributes<HTMLDivElement>

Skip AiCodeBlockProps props table
PropTypeDefaultDescription
defaultValue
string—Uncontrolled initial value.
value
string—Controlled value.
onValueChange
(value: string) => void—Called when the value changes.
data*
AiCodeBlockData[]——
labels
AiCodeBlockLabels—Override default English strings.
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

AiCodeBlockHeaderProps

Extends HTMLAttributes<HTMLDivElement>

Skip AiCodeBlockHeaderProps props table
PropTypeDefaultDescription
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

AiCodeBlockFilesProps

Extends Omit<HTMLAttributes<HTMLDivElement>, "children">

Skip AiCodeBlockFilesProps props table
PropTypeDefaultDescription
children*
AiCodeBlockChildren—Contents of the component.
className
string—Additional class names merged onto the root.
id
string—DOM id of the root element.

AiCodeBlockFilenameProps

Extends HTMLAttributes<HTMLDivElement>

Skip AiCodeBlockFilenameProps props table
PropTypeDefaultDescription
value
string—Controlled value.
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

AiCodeBlockSelectProps

Extends ComponentProps<typeof Select>

Skip AiCodeBlockSelectProps props table
PropTypeDefaultDescription
children*
AiCodeBlockChildren—Contents of the component.
className
string—Additional class names merged onto the root.
asChild
boolean—Render as the child element via Slot.

AiCodeBlockSelectItemProps

Extends ComponentProps<typeof SelectItem>

Skip AiCodeBlockSelectItemProps props table
PropTypeDefaultDescription
value
string—Controlled value.
disabled
boolean—Disables pointer and keyboard interaction.
children
ReactNode—Contents of the component.
className
string—Additional class names merged onto the root.

AiCodeBlockCopyButtonProps

Extends ComponentProps<typeof Button>

Skip AiCodeBlockCopyButtonProps props table
PropTypeDefaultDescription
onCopy
() => void——
onError
(error: Error) => void——
timeout
number2000—
code
string—Explicit payload. Defaults to the active file in `AiCodeBlock` data.
variant
string—Visual variant.
size
string—Control size.
asChild
boolean—Render as the child element via Slot.
disabled
boolean—Disables pointer and keyboard interaction.
type
string—Native type of the underlying element.
children
ReactNode—Contents of the component.
className
string—Additional class names merged onto the root.

AiCodeBlockBodyProps

Extends Omit<HTMLAttributes<HTMLDivElement>, "children">

Skip AiCodeBlockBodyProps props table
PropTypeDefaultDescription
children*
AiCodeBlockChildren—Contents of the component.
className
string—Additional class names merged onto the root.
id
string—DOM id of the root element.

AiCodeBlockItemProps

Extends HTMLAttributes<HTMLDivElement>

Skip AiCodeBlockItemProps props table
PropTypeDefaultDescription
value*
string—Controlled value.
lineNumbers
booleanfalse—
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.

AiCodeBlockContentProps

Extends HTMLAttributes<HTMLPreElement>

Skip AiCodeBlockContentProps props table
PropTypeDefaultDescription
language
BundledLanguage——
children*
string—Contents of the component.
className
string—Additional class names merged onto the root.
id
string—DOM id of the root element.