Skip to content

Inline and InlineBox ​

Both components style rich content inside a Text node. Use Inline for a span that may fragment across line or column boundaries. Use InlineBox when the styled content, logical padding, background, and border must stay together as one atomic inline item.

Inline ​

Inline is a span-like text run override. Children may be strings, nested Inline, InlineRect, or Ruby nodes. Inline can appear inside Text, TextOnPath, Inline, InlineBox, Ruby, or Rt.

Decorated Inline spans may fragment when the surrounding text wraps. The background and border are emitted for each fragment, with the outer corner radii retained at the start and end of the span.

Props ​

PropTypeDefaultDescription
fontstringinheritedOverride font alias
fallbackstring[]inheritedOverride fallback font alias chain
fontWeightnumberinheritedOverride font weight
fontStyle"normal" | "italic"inheritedOverride font style
fontVariationSettingsstringinheritedVariable font settings (for example, "'wght' 700")
fontFeatureSettingsstringinheritedOpenType feature settings (for example, "'liga' 0, 'smcp' 1")
textOrientation"mixed" | "upright"inheritedCharacter orientation in vertical text
textCombineUpright"none" | "all""none"Tate-chu-yoko
fontSizePxnumberinheritedOverride font size in px
letterSpacingPxnumberinheritedOverride letter spacing in px
colorstringinheritedOverride text color
textStrokesreadonly TextStrokeLayer[]inheritedReplace inherited stroke layers; [] clears them
textShadowsreadonly TextShadowLayer[]inheritedReplace inherited shadow layers; [] clears them
textDecorationTextDecorationinheritedReplace inherited decoration, or use "none" to stop it
language"ja" | "en" | "auto"inheritedOverride language hint for kinsoku processing
paddingInline[number, number][0, 0]Logical inline-start and inline-end padding in px
backgroundstring—Fragment background color
borderColorstring—Fragment border color
borderWidthnumber0Fragment border width in px
borderRadius[number, number, number, number][0,0,0,0]Corner radii [topLeft, topRight, bottomRight, bottomLeft] in px
childrenstring | Inline | InlineRect | Ruby—Rich inline content; arrays and nested child arrays are accepted

Example ​

tsx
<Text font="NotoSansJP" fontSizePx={16} color="#333333">
  This is <Inline color="#ef4444">red</Inline> and{" "}
  <Inline color="#3b82f6" fontWeight={700}>
    bold blue
  </Inline>{" "}
  text.
</Text>

Composition ranges can use decoration without changing shaping:

tsx
<Text font="NotoSansJP" fontSizePx={28}>
  入力:
  <Inline
    textDecoration={{ line: "underline", color: "#facc15", thicknessPx: 2 }}
  >
    きょう
  </Inline>
  <InlineRect inlineSizePx={2} color="#67e8f9" />
</Text>

INFO

InlineRect is allowed inside Inline, but InlineBox is not. Ruby base content may use Inline; Rt controls annotation decoration separately.

InlineBox ​

InlineBox is a decorated, atomic inline item. It can appear inside Text or another InlineBox, and its children may be strings, Inline, nested InlineBox, InlineRect, or Ruby nodes. Unlike Inline, an InlineBox does not split when the surrounding text wraps; the whole item moves to the next line or column.

Props ​

PropTypeDefaultDescription
fontstringinheritedOverride font alias
fallbackstring[]inheritedOverride fallback font alias chain
fontWeightnumberinheritedOverride font weight
fontStyle"normal" | "italic"inheritedOverride font style
fontSizePxnumberinheritedOverride font size in px
letterSpacingPxnumberinheritedOverride letter spacing in px
colorstringinheritedOverride text color
textDecorationTextDecorationinheritedReplace inherited decoration, or use "none" to stop it
language"ja" | "en" | "auto"inheritedOverride language hint for kinsoku processing
paddingInline[number, number][0, 0]Logical inline-start and inline-end padding in px
backgroundstring—Background color painted behind the atomic item
borderColorstring—Border color
borderWidthnumber0Border width in px
borderRadiusnumber0Radius applied to all four corners in px
childrenstring | Inline | InlineBox | InlineRect | Ruby—Rich inline content; arrays and nested child arrays are accepted

Example ​

tsx
<Text font="NotoSansJP" fontSizePx={22} color="#e2e8f0" width={360}>
  Status:{" "}
  <InlineBox
    paddingInline={[8, 8]}
    background="#0f766e"
    borderColor="#5eead4"
    borderWidth={1}
    borderRadius={6}
    color="#f0fdfa"
    fontWeight={700}
  >
    READY
  </InlineBox>
</Text>

INFO

InlineBox intentionally has a smaller typography surface than Inline. Properties such as fontVariationSettings, fontFeatureSettings, textOrientation, textCombineUpright, textStrokes, and textShadows are inherited from the surrounding text and cannot be overridden directly on an InlineBox.