Code
A fragment of code inside a line of text — a prop name, a command, a file path.
import { Code } from "antlitz";
API
| Prop | Type | Default |
|---|---|---|
| asChild | boolean | false |
| radius | "none" | "sm" | "md" | "lg" | "full" | none |
| size | "sm" | "md" | "lg" | md |
| tone | "base" | "muted" | "subtle" | base |
| variant | "soft" | "outline" | "plain" | soft |
Usage
pnpm add antlitzexport function Basic() {
return <Code>pnpm add antlitz</Code>;
}Variants
softoutlineplainexport function Variants() {
return VARIANTS.map((variant) => (
<Code key={variant} variant={variant}>
{variant}
</Code>
));
}Every variant keeps a 1px border — transparent where it is not drawn — so switching variants never changes the size of a fragment sitting in a sentence.
Sizes
smmdlgexport function Sizes() {
return SIZES.map((size) => (
<Code key={size} size={size}>
{size}
</Code>
));
}Size sets padding. The text size is 0.875em, relative to whatever contains
it, so a fragment stays proportional to the sentence it sits in rather than
snapping to a fixed scale.
Run pnpm add antlitz and it picks up the surrounding type scale.
export function InText() {
return (
<Text size="lg">
Run <Code>pnpm add antlitz</Code> and it picks up the surrounding type
scale.
</Text>
);
}Radius
nonesmmdlgfullexport function Radius() {
return RADII.map((radius) => (
<Code key={radius} radius={radius}>
{radius}
</Code>
));
}Tones
basemutedsubtleexport function Tones() {
return TONES.map((tone) => (
<Code key={tone} tone={tone}>
{tone}
</Code>
));
}Prose
Code is for interface text — a table cell, a label, a caption. Inside content
rendered with the Typeset stylesheet, a plain code element is already styled
and no component is needed.