Skip to content
kerfjsGitHub

Code

A short piece of code inside a sentence.

SourcePackage @kerf-js/veneerTry it

Preview

tsx
import { Code, Text } from '@kerf-js/veneer'export function InSentence() {  return (  <Text>    Set <Code>KERF_TOKEN</Code> before you run{' '}    <Code>kerf deploy</Code>.  </Text>  )}

Installation

npm install @kerf-js/veneer

Try it

Change the controls: the preview and its code update together. The address keeps what you set, so you can link to it.

Live preview
Controls
Codeupdates as you change the controls
import { Code } from '@kerf-js/veneer'<Code>kerf deploy</Code>

Usage

tsx
import { Code } from '@kerf-js/veneer'<Code>kerf deploy</Code>

Names and values

Use Code to mark a name or value inside a sentence.

tsx
import { Code } from '@kerf-js/veneer'export function Names() {  return (  <>    <Code>main</Code>    <Code>9f3ac21</Code>    <Code>eu-west</Code>  </>  )}

On a card

A Code can sit inline in a sentence, here on a card, to mark a commit, a branch and a region.

tsx
import { Card, Code, Text } from '@kerf-js/veneer'export function OnACard() {  return (  <Card    eyebrow="Latest"    title="Cache product images at the edge"  >    <Text subtle>      Deployed <Code>9f3ac21</Code>      {' from '}      <Code>main</Code> to <Code>eu-west</Code>.    </Text>  </Card>  )}

When to use

Use it for

  • Names, flags and commands in running text

Reach for something else

Accessibility

  • This has no shortcuts of its own: controls inside it use Tab, Enter and Space as usual, and veneer's parts keep their roles and labels.

API Reference

PropTypeDefaultDescription
childrenunknown—What it contains.

RelatedCode blockSnippetKbd