antlitz
Menu

Code

A fragment of code inside a line of text — a prop name, a command, a file path.

import { Code } from "antlitz";

API

PropTypeDefault
asChildbooleanfalse
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 antlitz
export function Basic() {
  return <Code>pnpm add antlitz</Code>;
}

Variants

softoutlineplain
export 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

smmdlg
export 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

nonesmmdlgfull
export function Radius() {
  return RADII.map((radius) => (
    <Code key={radius} radius={radius}>
      {radius}
    </Code>
  ));
}

Tones

basemutedsubtle
export 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.