EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
CodeBlock·component·@astryxdesign/core

Code

Inline code element. Renders a styled <code> with monospace font and muted background. For fenced blocks, use CodeBlock.

Open in Playground @astryxdesign/core/CodeBlock

Showcases and examples

4 documented examples

Code

Inline code snippets inside a sentence showing how Code renders alongside body text.

Preview loads on approachPreview loads on approach
Exact source · code-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {Code} from '@astryxdesign/core/CodeBlock';
import {Text} from '@astryxdesign/core/Text';
import {Stack} from '@astryxdesign/core/Layout';

export default function CodeShowcase() {
  return (
    <Stack direction="vertical" gap={3}>
      <Text type="body">
        Run <Code>npm install @astryxdesign/core</Code> to add the package.
      </Text>
      <Text type="body">
        Use the <Code>variant</Code> prop to switch between <Code>primary</Code>
        , <Code>secondary</Code>, and <Code>ghost</Code> styles.
      </Text>
    </Stack>
  );
}

Usage

Inline code element. Renders a styled <code> with monospace font and muted background. For fenced blocks, use CodeBlock.

Typed props

PropType and behavior
childrenReactNode · required
Code content.
xstyleStyleXStyles
StyleX styles for layout customization. Must be a stylex.create() value.
classNamestring
CSS class name for the root element. Prefer xstyle for styling.
styleCSSProperties
Inline styles. Prefer xstyle for StyleX-optimized styling.
data-testidstring
Test selector for automated testing frameworks.