Skip to content
wdj

Code / CodeHighlighted

Partial Display

Escaped Pygments grammar highlighting, multiline tokens, line numbers, highlighted lines and localized copying.

Kumo reference: kumo-ui.com/components/code-highlighted/

Presentation commands show demo feedback. Read the interaction guide to connect real actions.

Inline code

python manage.py runserver
Show template
{% load wdj %}
{% include "wdj/components/code.html" with code="python manage.py runserver" inline=True only %}

Code block

bash
python manage.py runserver
Show template
{% load wdj %}
{% include "wdj/components/code.html" with code="python manage.py runserver" lang="bash" only %}

Filename

settings.py python
DEBUG = False
Show template
{% load wdj %}
{% include "wdj/components/code.html" with code="DEBUG = False" lang="python" filename="settings.py" only %}

Without copy

python
print(123)
Show template
{% load wdj %}
{% include "wdj/components/code.html" with code="print(123)" lang="python" copyable=False only %}

Basic highlighting

python
from wdj import charts​option = charts.line([{ "name": "Requests", "data": [10, 20, 30] }])# Server-owned datareturn option
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_python lang="python" only %}

TypeScript

ts
const selected = "overview";function select(value) {  return value === selected;}
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_js lang="ts" only %}

Shell commands

bash
python -m pytestnpm run css:build
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_bash lang="bash" only %}

JSON

json
{  "name": "demo",  "enabled": true,  "count": 42}
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_json lang="json" only %}

CSS

css
.panel {  color: var(--color-kumo-default);  padding: 16px;}
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_css lang="css" only %}

Highlighted lines

python
from wdj import charts​option = charts.line([{ "name": "Requests", "data": [10, 20, 30] }])# Server-owned datareturn option
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_python lang="python" highlight_lines="3-4" only %}

Line numbers

python
from wdj import charts​option = charts.line([{ "name": "Requests", "data": [10, 20, 30] }])# Server-owned datareturn option
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_python lang="python" line_numbers=True only %}

Copy button

example.py
from wdj import charts​option = charts.line([{ "name": "Requests", "data": [10, 20, 30] }])# Server-owned datareturn option
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_python lang="python" filename="example.py" only %}

Plain code surface

python
from wdj import charts​option = charts.line([{ "name": "Requests", "data": [10, 20, 30] }])# Server-owned datareturn option
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_python lang="python" plain=True only %}

Localized copy action

json
{  "name": "demo",  "enabled": true,  "count": 42}
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_json lang="json" copy_label="Copiază codul" only %}

Shared server highlighter

Both examples use wdj.code.lines on the server and the same vendored theme.

example.js
const selected = "overview";function select(value) {  return value === selected;}
example.json
{  "name": "demo",  "enabled": true,  "count": 42}
Show template
{% load wdj %}
<p class="text-base text-kumo-subtle">Both examples use wdj.code.lines on the server and the same vendored theme.</p>{% include "wdj/components/code_highlighted.html" with code=audit_code_js lang="js" filename="example.js" only %}{% include "wdj/components/code_highlighted.html" with code=audit_code_json lang="json" filename="example.json" only %}

Custom highlight color

js
const selected = "overview";function select(value) {  return value === selected;}
Show template
{% load wdj %}
{% include "wdj/components/code_highlighted.html" with code=audit_code_js lang="js" highlight_lines="2-3" class="wdj-code-highlight-warning" only %}

Multiline grammar highlighting

report.sql
/* A multiline comment   retains its grammar state. */SELECT name, 'Example' AS labelFROM resourcesWHERE enabled = TRUE;
Show template
{% load wdj %}
{% include 'wdj/components/code_highlighted.html' with code=recommendation_code lang='sql' filename='report.sql' line_numbers=True highlight_lines='1-2' only %}

API Reference

Prop Type Default Description
string unset Code; pass the documented value shown in the examples.
string unset Lang; pass the documented value shown in the examples.
bool False Inline; pass the documented value shown in the examples.
string unset Filename; pass the documented value shown in the examples.
bool True Copyable; pass the documented value shown in the examples.
string / HTML slot unset Rich HTML supplied by the wdj_component block tag, rendered in an isolated context.
dict {} Dictionary of escaped native, HTMX or Alpine attributes. Literal Tailwind classes only.
string "" Class; pass the documented value shown in the examples.
string / list unset Use code with wdj/components/code_highlighted.html. This is a separate template.
string / list unset Use lang with wdj/components/code_highlighted.html. This is a separate template.
string / list unset Use highlight_lines with wdj/components/code_highlighted.html. This is a separate template.
bool unset Use line_numbers with wdj/components/code_highlighted.html. This is a separate template.
bool unset Use plain with wdj/components/code_highlighted.html. This is a separate template.
string / list unset Use filename with wdj/components/code_highlighted.html. This is a separate template.
bool unset Use copyable with wdj/components/code_highlighted.html. This is a separate template.
string / list unset Use copy_label with wdj/components/code_highlighted.html. This is a separate template.

Accessibility notes

Every interactive component keeps real semantics and keyboard support: native controls where possible, ARIA only where necessary, and a visible focus ring. See the Accessibility page for the shared contract.

Read the accessibility contract

Components

Components overview
AutocompleteFree-form input with local or HTMX-filtered suggestions.
BadgeSolid, tinted, outline and dot status labels.
BannerInline message bar with variants and optional action.
BreadcrumbsTrail navigation in two sizes.
ButtonVariants, sizes, shapes, icons and loading state.
ButtonGroupJoins a small set of tightly-coupled buttons into a single control (split buttons).
CheckboxSingle checkbox and indeterminate state.
ClipboardTextRead-only text field with a one-click copy-to-clipboard button.
Code / CodeHighlightedEscaped Pygments grammar highlighting, multiline tokens, line numbers, highlighted lines and localized copying.
CollapsibleComposable disclosure component for showing and hiding content.
Combobox / AutocompleteKumo-styled input/button triggers, search inside the popup, grouped local choices and debounced HTMX search.
CommandPaletteAccessible spotlight search overlay with Cmd+K keyboard shortcut.
DatePickerKumo-styled date and datetime popups; inline single, multiple and range calendars with bounds/presets.
DateRangePickerStyled popup or inline range calendar with bounds, presets and separately named form values.
DialogNative <dialog> modal with focus management.
DrawerEdge-anchored modal panel. LayerDialog has its own layered component.
DropdownMenuNative details menu with delegated keyboard navigation and dismissal.
EmptyEmpty-state placeholder with icon and action.
FieldLabel + description + error wrapper. Built into each control.
FlowDirected diagrams with branches, SVG connectors, custom anchors and responsive local scrolling.
GridResponsive CSS grid layout container with preset column configurations.
InlineCopyTextCompact borderless copy control for IDs and short values.
InputText field with label, description, leading/trailing icons.
InputAreaMulti-line textarea with auto-resize option.
InputGroupInput field with seamless prefix, suffix, and addon attachments.
LabelForm field label, optional marker and tooltip.
LayerCardCompound surface card with distinct primary and secondary layers.
LayerDialogLayered native modal with actions, forms, nested dialogs and pending states.
LinkInline, current and plain text links.
LoaderAnimated spinner in three sizes.
MenuBarCompact view selector using native radio semantics.
MeterProgress bar showing a measured value within a known range.
PaginationA page navigation component for navigating through paginated content.
PopoverAnchored popup with interactive content.
RadioRadio group, vertical and horizontal.
SelectKumo-styled Alpine dropdown with groups, rich options and multiple selection; native form values and fallback.
SensitiveInputPassword/secret input with reveal toggle and copy button.
SeparatorHorizontal / vertical rules with optional label.
SidebarRecursive navigation groups, account/zone views, search, loading, resize and full-screen mobile breadcrumbs.
SkeletonShimmer placeholder.
SliderInset single/range selection with vertical grips, value badges, endpoint labels and native keyboard/form behavior.
SurfaceBordered surface panel with header slot.
SwitchOn/off toggle in three sizes.
TableServer-driven table: sort, filter, select and paginate the full dataset.
Table of contentsPage section navigation tree with active link indicator.
TabsSegmented and underline tabs with a sliding indicator, responsive overflow and local Alpine or URL/HTMX state.
TagInputMulti-value badge input for tags and recipients.
TextHeading, body, secondary, success, error and mono text.
ToastyExpandable notification stack with variants, paused expiry and a live region.
ToolbarCompact grouped controls with shared borders, composed filters and keyboard arrow navigation.
TooltipHover and focus tooltip with grouped delays, Escape dismissal and viewport bounds.
↑ ↓ Navigate ↵ Select