[object Promise]

# ChatCodeBlock API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Chat - Code blocks](/x/react-chat/display/message-parts/code-blocks/)

## Import

```jsx
import { ChatCodeBlock } from '@mui/x-chat/ChatCodeBlock';
// or
import { ChatCodeBlock } from '@mui/x-chat';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| children | `string` | - | Yes |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| highlighter | `function(code: string, language: string) => React.ReactNode` | - | No |  |
| language | `string` | - | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |

> **Note**: The `ref` is forwarded to the root element.

> Any other props supplied will be provided to the root element (native element).

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | code | Styles applied to the code element. |
| - | copyButton | Styles applied to the copy button element. |
| - | header | Styles applied to the header element. |
| - | languageLabel | Styles applied to the language label element. |
| - | pre | Styles applied to the pre element. |
| - | root | Styles applied to the root element. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/x-chat/src/ChatCodeBlock/ChatCodeBlock.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/x-chat/src/ChatCodeBlock/ChatCodeBlock.tsx)