Code-Block — component.code-block
Code-Fenster im Syntax-Stil: dunkle Flaeche in jedem Theme (color.code.*-Tokens), Traffic-Dots, Dateinamen-Tab, Kopieren-Knopf, Zeilennummern, serverseitiges Syntax-Highlighting (php/js/json/bash/html/css). 2.1.0: feste Texte mehrsprachig (invisible_i18n, texte.json). 2.2.0: Quelltext bis 200000 Zei
Beispiele
PHP mit Highlighting + Zeilennummern
// Tür 1: Framework als Bibliothek
$rows = kunden_rest_list(['limit' => 25]);
echo invisible_render_id('component.table', [
'columns' => $spalten,
'rows' => $rows,
]);
JSON
{
"id": "ui.button",
"version": "1.0.0",
"targets": ["web.document"],
"copyable": true,
"order": 12
}
Ohne Sprache (nur escaped)
Foundations
└── Layouts
└── UI Elements
Script-Injection bleibt Text
const evil = '<script>alert(1)</script>';
Eigenschaften
| Prop | Typ | Default |
|---|---|---|
code * | string | — |
filename | string | "" |
language | string | "" |
lineNumbers | boolean | false |
copyable | boolean | true |
tone | string: dark | theme | "dark" |
dots | boolean | true |
padding | string: standard | none | sm | md | lg | xl | "standard" |
margin | string: standard | none | sm | md | lg | xl | "standard" |
border | string: standard | none | hairline | strong | "standard" |
radius | string: standard | none | control | surface | pill | "standard" |
textColor | string | "" |
backgroundColor | string | "" |
shadow | string: standard | none | sm | md | lg | "standard" |
width | string: standard | full | "standard" |
alignSelf | string: standard | start | center | end | "standard" |
anchor | string | "" |
Events & Slots
Events: copy
Stellschrauben (Komponenten-Tokens)
| Token | Default |
|---|---|
--code-block-code-border | var(--color-code-border) |
--code-block-code-comment | var(--color-code-comment) |
--code-block-code-keyword | var(--color-code-keyword) |
--code-block-code-line-number | var(--color-code-line-number) |
--code-block-code-muted | var(--color-code-muted) |
--code-block-code-number | var(--color-code-number) |
--code-block-code-property | var(--color-code-property) |
--code-block-code-string | var(--color-code-string) |
--code-block-code-surface | var(--color-code-surface) |
--code-block-code-surface-raised | var(--color-code-surface-raised) |
--code-block-code-text | var(--color-code-text) |
--code-block-code-variable | var(--color-code-variable) |
--code-block-elevation-overlay | var(--elevation-overlay) |
--code-block-radius-full | var(--radius-full) |
--code-block-radius-sm | var(--radius-sm) |
--code-block-radius-surface | var(--radius-surface) |
Genutzte Design-Tokens
border.hairline color.border.default color.code.border color.code.comment color.code.keyword color.code.line-number color.code.muted color.code.number color.code.property color.code.string color.code.surface color.code.surface-raised color.code.text color.code.variable color.surface.default color.surface.sunken color.text.accent color.text.default color.text.link color.text.muted duration.fast easing.standard elevation.overlay font.family.default font.family.mono leading.base radius.full radius.sm radius.surface size.1 size.2 size.3 size.4 size.8 text.sm text.xs