> For the complete documentation index, see [llms.txt](https://docs.webstudio.is/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.webstudio.is/university/core-components/code-text.md).

# Code Text

Display source code with language-aware syntax highlighting.

Use Code Text to display source code with syntax highlighting. It renders a semantic `<code>` element and preserves the source text for copying and screen readers.

## When to use

Use Code Text for code examples, commands, configuration, or other source text. Use [Text](/university/core-components/text.md) for prose that does not need syntax highlighting.

## How to use

1. Open the **Components** panel.
2. Expand **Typography**.
3. Drag **Code Text** onto the canvas.
4. Enter the source in **Text Content** in the Settings panel, or edit it on the canvas.
5. Select the matching **Language**.
6. Select a **Theme**.

**Text Content** opens a code editor that uses the selected language for syntax highlighting.

In Content mode, editors can change **Text Content** and **Language**. Change **Theme** in Design mode.

You can bind **Text Content**, **Language**, and **Theme** to variables or resource values. A fixed Language or Theme includes only that selected asset in the published build. A bound Language or Theme makes the available catalog part of the server build so any runtime value can be rendered. The browser loads only the language and theme selected at runtime.

The highlighted markup is rendered with SSR and SSG output, so it appears consistently when the page first loads and after it becomes interactive.

## Styling

Apply typography, spacing, border, and background styles in the Style panel. The selected theme supplies the syntax token colors and initial text and background colors. A background set in the Style panel overrides the theme background; select another theme to change the syntax colors.

## Related

* [Text](/university/core-components/text.md)
* [HTML Embed](/university/core-components/html-embed.md)
* [Paragraph](/university/core-components/paragraph.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.webstudio.is/university/core-components/code-text.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
