Documentation
Data display
Code
Renders inline code and framed code blocks with theme-aware palettes.
01
See it in context
Preview
Apply the current theme with data-theme on the root element.
const theme = "lumen";
const accent = "hsl(var(--accent))";Override the syntax palette family with theme.
const theme = "lumen";
const accent = "hsl(var(--accent))";const theme = "lumen";
const accent = "hsl(var(--accent))";02
Copy a working example
Usage
Astro examples assume UIPrimitives is mounted once in your root layout. Do not add the runtime next to each component instance.
---
import { Code } from '@santi020k/lumen-astro'
const themeExample = `
const theme = "lumen";
const accent = "hsl(var(--accent))";
`
---
<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>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>---
import { Code } from '@santi020k/lumen-astro'
const themeExample = `
const theme = "lumen";
const accent = "hsl(var(--accent))";
`
---
<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>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>import { Code } from '@santi020k/lumen-react'
const themeExample = `
const theme = "lumen";
const accent = "hsl(var(--accent))";
`
export const Example = () => (
<Code code={themeExample} copy label="theme.ts" language="ts" variant="block" />
)import { Code } from '@santi020k/lumen-react'
const themeExample = `
const theme = "lumen";
const accent = "hsl(var(--accent))";
`
export const Example = () => (
<Code code={themeExample} copy label="theme.ts" language="ts" variant="block" />
)<script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<lumen-code data-code-theme="auto" variant="block">
<figcaption class="ui-code__header">
<span class="ui-code__dots" aria-hidden="true">
<span class="ui-code__dot ui-code__dot--red"></span>
<span class="ui-code__dot ui-code__dot--yellow"></span>
<span class="ui-code__dot ui-code__dot--green"></span>
</span>
<span class="ui-code__meta">
<span class="ui-code__language">ts</span>
<span class="ui-code__label">theme.ts</span>
</span>
</figcaption>
<pre><code>const theme = "lumen";
const accent = "hsl(var(--accent))";</code></pre>
</lumen-code><script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<lumen-code data-code-theme="auto" variant="block">
<figcaption class="ui-code__header">
<span class="ui-code__dots" aria-hidden="true">
<span class="ui-code__dot ui-code__dot--red"></span>
<span class="ui-code__dot ui-code__dot--yellow"></span>
<span class="ui-code__dot ui-code__dot--green"></span>
</span>
<span class="ui-code__meta">
<span class="ui-code__language">ts</span>
<span class="ui-code__label">theme.ts</span>
</span>
</figcaption>
<pre><code>const theme = "lumen";
const accent = "hsl(var(--accent))";</code></pre>
</lumen-code>03
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.
pnpm add @santi020k/lumen-astropnpm add @santi020k/lumen-astrolumen add Codelumen add Codepnpm add @santi020k/lumen-reactpnpm add @santi020k/lumen-reactlumen add Code --target reactlumen add Code --target reactpnpm add @santi020k/lumen-elementspnpm add @santi020k/lumen-elementslumen add Code --target elementslumen add Code --target elementsAPI 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.
| Attribute | Values | Default | Description |
|---|---|---|---|
| variant | "inline" | "block" | "inline" | Switches between inline code and a framed code block. |
| code | string | - | Renders a normalized multiline code string with lightweight token colors. |
| language | string | - | Labels the code language in block headers. |
| label | string | - | Adds a compact filename or title to the block header. |
| copy | boolean | false | Shows a copy button when UIPrimitives is mounted. |
| highlighted | boolean | false | Allows a pre-highlighted pre/code tree, such as Shiki output, to render directly. |
| theme | "auto" | "lumen" | "santi020k" | "auto" | Selects the code palette family. |
| class, className | string | "" | Merges custom classes with the generated ui-* root classes. |
| ...native attributes | HTML attributes | - | Forwards standard attributes to the root element unless the component consumes them. |