Basic usage
Constructor
Default code to display
Programming language for syntax highlighting. Options include:
- “python”, “javascript”, “typescript”, “java”, “c”, “cpp”
- “html”, “css”, “json”, “yaml”, “markdown”
- “sql”, “r”, “shell”, “dockerfile”
gr.Code.languages for full listMinimum number of visible lines
Maximum number of visible lines. If None, fills container height
If True, wraps long lines to fit width
Whether to display line numbers
Whether to show autocomplete suggestions
Whether code can be edited
Buttons to show. By default, “copy” and “download” are shown
Events
- change - Triggered when code changes
- input - Triggered on keystroke
- focus - Triggered when editor gains focus
- blur - Triggered when editor loses focus