Code editor component for Gradio, supports viewing and editing code in multiple languages.
# Source: https://github.com/gradio-app/gradio | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""gr.Code() component"""
from __future__ import annotations
from collections.abc import Callable, Sequence
from typing import TYPE_CHECKING, Any, Literal
from gradio_client.documentation import document
from gradio.components.base import Component
from gradio.components.button import Button
from gradio.events import Events
from gradio.i18n import I18nData
from gradio.utils import set_default_buttons
if TYPE_CHECKING:
from gradio.components import Timer
@document("languages")
class Code(Component):
"""
Creates a code editor for viewing code (as an output component), or
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key