Code Block

@sushindustries/ui

A highlighted code slab in the CLI's colours, with a copy button that confirms in place.

Last updated Aug 17, 20266 min read
View as MarkdownEdit on GitHub

Props

PropTypeDefaultDoes
codestring-The source. One trailing newline is dropped, so the copy is exactly what is shown.
language?string-Fence language. Aliases like bash and js resolve; unknown falls back to plaintext.
copy?booleantrueThe copy button is the default; a caller showing a fragment can decline it.
file?string-Filename from the fence's file="..." metadata, shown above the code.

Notes

copy and file both being unset is the only case that skips the code-shell wrapper and its tools row entirely - set either one and you get the wrapper, the language chip, and whichever of the two you asked for.

language never throws. An alias resolves through resolveLanguage (bash, js, jsx and a few others); anything else that is not a registered grammar falls back to plaintext, rendered but unstyled, rather than failing the build or the render.

UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · contentCopy ButtonCopy ButtonA glass chip that writes to the clipboard and confirms in the button itself, then hands back.@sushindustries/ui · content
Used byMarkdown ViewMarkdown ViewRenders Markdown with callouts, CSS-only tabs, custom blocks and highlighted code.@sushindustries/ui · content