Labels¶
Customize the language pill text displayed in the editor header using the label attribute.
Default label¶
The default label is "Python":
Custom label¶
Set a custom label to describe your code:
Fence syntax¶
When to use each¶
| Scenario | Recommended Label |
|---|---|
| General Python code | Python (default) |
| Panel-specific examples | Panel or Panel App |
| Library-specific demos | Library name (e.g. hvPlot) |
| Tutorial steps | Step description (e.g. Step 1) |
Naming rationale¶
The label attribute name was chosen deliberately:
- Semantic — "label" describes the purpose (identifying what the code is) rather than the visual presentation
- HTML convention — aligns with
<label>in HTML forms,aria-labelin accessibility, andlabelin many component libraries - Not visual — alternatives like
badge,pill, ortagdescribe how it looks, not what it means. Visual presentation can change; the semantic role remains stable - Future-proof —
titleanddescriptionremain available for supplementary metadata if needed later.namewas avoided because it conflicts with the HTMLnameattribute used for form submission