Search the documentation

Type to search page titles, component names and descriptions.

    General

    Typography

    Text roles, inline code and bounded code blocks.

    import { Code, CodeBlock, Text } from 'faifo-design'

    Text applies a typography role (headingLg, bodyMd, bodySm…) independently of the element it renders, so a visual heading can be an h3 in one place and a p in another without changing its look. Code marks an exact machine value inline; CodeBlock holds multi-line machine text that keeps its whitespace and scrolls inside a bounded height.

    #When to use

    • Choose the role by what the text does in the component, then choose the element (as) by the document outline.
    • Do not set font sizes or weights in application CSS. A component that owns text already names its role.
    • Use Code for identifiers, references and values a person may copy exactly. Use CodeBlock for a request body, a response or a command.

    #Examples

    Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.

    #Text and Porto Faifo symbols

    Typography role, document semantics and shared icon geometry.

    Operations

    One typography contract for every component.

    1,284.00
    Show codeHide code
    import { Icon, Inline, Stack, Text } from 'faifo-design'
    
    export const Example = () => (
      <Stack
        items={[
          <Text as="h3" variant="headingLg">
            Operations
          </Text>,
          <Text as="p" variant="bodyMd">
            One typography contract for every component.
          </Text>,
          <Inline
            items={[
              <Icon name="layers-3" label="Workspace" />,
              <Icon name="building-2" label="Company" />,
              <Icon name="layout-grid" label="Applications" />,
              <Icon name="sun" label="Light theme" />,
              <Icon name="moon" label="Dark theme" />,
              <Icon name="info" label="Information" />,
              <Icon name="circle-check" tone="positive" label="Complete" />,
              <Text numeric>1,284.00</Text>,
            ]}
          />,
        ]}
      />
    )

    #Code block

    Multi-line machine text that keeps whitespace and scrolls within a bounded height.

    {
      "error": {
        "code": "E_HTTP_INVALID_REQUEST",
        "message": "the request is invalid",
        "requestId": "8f0c6a8e-5b7e-4f39-9a51-3cc0e5b0d4a1",
        "fields": {
          "limit": [
            {
              "field": "limit",
              "code": "type",
              "messageKey": "validation.type"
            }
          ]
        }
      }
    }
    curl -X POST 'https://api.example.com/v1/sales/orders/SO-2026-000184/confirm?notify=customer&channel=web' \
      -H 'Idempotency-Key: 3f2a8c1e-5b7d-4e9a-8c6f-1d2e3f4a5b6c'
    Show codeHide code
    import { CodeBlock, Stack } from 'faifo-design'
    
    export const Example = () => (
      <Stack
        items={[
          <CodeBlock
            label="Response body"
            language="json"
            value={JSON.stringify(
              {
                error: {
                  code: 'E_HTTP_INVALID_REQUEST',
                  message: 'the request is invalid',
                  requestId: '8f0c6a8e-5b7e-4f39-9a51-3cc0e5b0d4a1',
                  fields: { limit: [{ field: 'limit', code: 'type', messageKey: 'validation.type' }] },
                },
              },
              null,
              2,
            )}
          />,
          <CodeBlock
            label="curl command"
            language="shell"
            wrap
            value={`curl -X POST 'https://api.example.com/v1/sales/orders/SO-2026-000184/confirm?notify=customer&channel=web' \\\n  -H 'Idempotency-Key: 3f2a8c1e-5b7d-4e9a-8c6f-1d2e3f4a5b6c'`}
          />,
        ]}
      />
    )

    #Contract

    #Code blocks

    CodeBlock({ value, label, language?, wrap? }) shows literal text a reader copies or inspects: a JSON payload, a response body, a shell command. It renders <pre data-ui="code-block"><code> as a labelled, keyboard-focusable region (role="region", aria-label, tabindex="0"), so a long payload scrolls inside its own frame and is reachable without a pointer. The block is bounded to 24 lines; longer text scrolls vertically, and wide lines scroll horizontally unless wrap (data-wrap="true") folds them, which suits a command but not indented JSON. language is recorded as data-language for consumers that announce or copy it; the block does not highlight syntax. Type, frame and focus ring come from tokens (--faifo-font-mono, --faifo-text-xs, --faifo-panel-border, --faifo-color-surface-subtle). Specimen: code-block under Status.

    #API

    Generated from the package source. A property without a description has none in the source yet.

    #CodeComponent

    PropertyDescriptionTypeDefault
    valuerequired–string–
    context–string | null–

    #CodeBlockComponent

    Multi-line machine text: a request body, a response, a command. The block keeps whitespace, scrolls inside itself past a bounded height, and is a named, focusable region so keyboard users can scroll it. wrap breaks long lines instead of scrolling sideways, for prose-like values such as commands.

    PropertyDescriptionTypeDefault
    valuerequired–string–
    labelrequired–string–
    language–string | null–
    wrap–boolean–

    #TextComponent

    Typography role is independent of document heading level. Omitted variant inherits.

    PropertyDescriptionTypeDefault
    childrenrequired–JSXChild–
    as–'span' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'strong' | 'dt' | 'dd' | 'legend''span'
    id–string–
    variant–TextVariant–
    tone–'default' | 'muted' | 'disabled' | 'info' | 'positive' | 'warning' | 'danger' | 'inherit''default'
    fontWeight–'regular' | 'medium' | 'semibold' | 'bold'–
    alignment–'start' | 'center' | 'end'–
    numeric–boolean–
    truncate–boolean–
    breakWord–boolean–
    visuallyHidden–boolean–

    #Types

    #TextProps

    The properties of Text, listed above.

    #TextVariant

    type TextVariant =
      | 'bodyXs'
      | 'bodySm'
      | 'bodyMd'
      | 'bodyLg'
      | 'headingXs'
      | 'headingSm'
      | 'headingMd'
      | 'headingLg'
      | 'headingXl'
      | 'heading2xl'
      | 'heading3xl'