Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Data display

Code

Renders inline code and framed code blocks with theme-aware palettes.

FrameworksAstro · React · Elements

Registry commandlumen add Code

InteractionEnhanced runtime

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroSame visual contract, native framework API

Apply the current theme with data-theme on the root element.

tstheme.ts
const theme = "lumen";
const accent = "hsl(var(--accent))";

Wrap prose-like output or long commands when horizontal scrolling would obscure the content.

yaml.github/workflows/validate.yml
name: Lumen checks
on:
  pull_request:
jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - run: pnpm validate

Language colors come from the active Lumen semantic theme tokens without a Shiki setup.

bash
pnpm add @santi020k/lumen-astro

Override the syntax palette family with theme.

tslumen
const theme = "lumen";
const accent = "hsl(var(--accent))";
tssanti020k
const theme = "lumen";
const accent = "hsl(var(--accent))";

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { Code } from '@santi020k/lumen-astro'

const themeExample = `
  const theme = "lumen";
  const accent = "hsl(var(--accent))";
`

const workflowExample = `
  name: Lumen checks
  on:
    pull_request:
  jobs:
    validate:
      runs-on: ubuntu-latest
      steps:
        - run: pnpm validate
`
---

<div class="grid gap-4">
  <p>Apply the current theme with <Code>data-theme</Code> on the root element.</p>
  <Code code={themeExample} copy label="theme.ts" language="ts" variant="block" />

  <p>Wrap prose-like output or long commands when horizontal scrolling would obscure the content.</p>
  <Code
    code={workflowExample}
    copy
    label=".github/workflows/validate.yml"
    language="yaml"
    variant="block"
    wrap
  />

  <p>Language colors come from the active Lumen semantic theme tokens without a Shiki setup.</p>
  <Code
    code="pnpm add @santi020k/lumen-astro"
    copy
    language="bash"
    variant="block"
  />

  <p>Override the syntax palette family with <Code>theme</Code>.</p>
  <Code code={themeExample} label="lumen" language="ts" theme="lumen" variant="block" />
  <Code code={themeExample} label="santi020k" language="ts" theme="santi020k" variant="block" />
</div>
Edit Code in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add Code
lumen add Code

API reference

Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.

AttributeValuesDefaultDescription
variant"inline" | "block""inline"Switches between inline code and a framed code block.
codestring-Renders normalized multiline code with semantic, theme-token-based syntax colors.
languagestring-Labels and highlights JavaScript, TypeScript, JSON, YAML, Bash, Astro/HTML, Markdown, Lua, and SQL families. Unsupported languages remain readable plaintext.
labelstring-Adds a compact filename or title to the block header.
copybooleanfalseShows a copy button when UIPrimitives is mounted.
highlightedbooleanfalseAllows a pre-highlighted pre/code tree, such as Shiki output, to render directly.
theme"auto" | "lumen" | "santi020k""auto"Selects the code palette family.
wrapbooleanfalseWraps long block-code lines instead of requiring horizontal scrolling; code blocks also stay within their flex or grid container.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Web docsFull catalog