DS | Adila.co
Componentes

Code Block

Bloco de código com syntax highlighting, linhas numeradas e botão de copiar.

button.tsxtsx
import { Button } from '@adila-sh/ui';
export function SaveButton() {const label = 'Salvar alterações';return <Button>{label}</Button>;}

Instalação

bun add @adila-sh/ui

Uso

import { CodeBlock } from "@adila-sh/ui";

export function Example() {
  return (
    <CodeBlock
      code={`const greeting = 'Olá, mundo!';`}
      language="typescript"
      filename="example.ts"
      showLineNumbers
      highlightLines={[1]}
    />
  );
}

Linguagens

O highlighter reconhece JavaScript, TypeScript, JSX, TSX, JSON, Bash, Shell, CSS, HTML, SVG, XML e MDX. Linguagens não reconhecidas recebem a formatação base sem comprometer a legibilidade.

Linhas em destaque

Passe números de linha em highlightLines para chamar atenção para mudanças ou trechos importantes.

Nesta página