Codeblock overview
Codeblock gives you a ready-made wrapper for rendered source with copy actions, line numbers, focused ranges, wrapping, and highlighting metadata.
Imports
Component import
ts
import { TngCodeBlockComponent } from '@tailng-ui/components';
Style variants
Use the wrapper inside a plain CSS shell or a utility-authored Tailwind surface.
Plain CSS codeblock
app.config.ts
ts
const config = {
mode: 'preview',
retries: 2,
};
export function buildLabel(name: string): string {
return `${name}:${config.mode}`;
}
Default wrapper shell
Tailwind CSS codeblock
app.config.ts
ts
const config = {
mode: 'preview',
retries: 2,
};
export function buildLabel(name: string): string {
return `${name}:${config.mode}`;
}
Ghost variant with focused lines
Accessibility baseline
- Use a meaningful
titleorcaptionwhen the snippet stands alone. - Keep copy labels explicit with
copyLabel,copiedLabel, anderrorLabel. - Use
highlightLinesandfocusLinessparingly so emphasis stays readable.