Relaycode

Text Input

Generic string input and fallback for unknown types

import { Text } from "@/components/params/inputs/text";

<Text
  name="remark"
  label="Remark"
  description="An arbitrary string"
  client={client}
  typeId={10}
  onChange={(value) => console.log("Text:", value)}
/>

Text Input

The Text input is a plain string field that serves as the fallback component for any parameter type that does not match a more specific input in the registry. It accepts arbitrary text and emits it as a raw string.

Supported Type Names

The Text component is not registered with explicit patterns in the input map. Instead, it is the fallback returned by findComponent when no other component matches the given type name. Any type that does not match Account, Balance, Amount, Bool, Hash, Bytes, Call, Moment, Vote, VoteThreshold, KeyValue, Option, Vector, Tuple, Struct, or Enum will resolve to Text.

Props

The component accepts the standard ParamInputProps interface:

PropTypeRequiredDescription
namestringYesField identifier used for the HTML id and form state
labelstringNoDisplay label shown above the input
descriptionstringNoHelp text shown below the input
typeNamestringNoThe SCALE type name
isDisabledbooleanNoDisables the input when true
isRequiredbooleanNoShows a red asterisk next to the label
errorstringNoValidation error message to display
clientDedotClient<PolkadotApi>YesConnected Dedot client
typeIdnumberNoMetadata type ID for this parameter
valueanyNoExternally controlled value (e.g. from hex decode) -- converted to string via String()
onChange(value: unknown) => voidNoCallback fired with the string value

Features

  • Universal fallback: Any unrecognized type name in the metadata resolves to this component, ensuring every parameter has an input.
  • External value sync: When an external value is set (e.g. from hex decoding), it is coerced to a string via String() and displayed.
  • Monospace font: Uses a monospace font for consistency with other technical inputs.
  • Error styling: The input border turns red when a validation error is present.

Type Resolution

import { findComponent } from "@/lib/input-map";

// Unknown types fall back to the Text component
findComponent("SomeUnknownType", typeId, client);
findComponent("Foo", typeId, client);

Usage

The Text component is rendered by the extrinsic builder as the default fallback. It can also be used directly:

import { Text } from "@/components/params/inputs/text";

<Text
  name="remark"
  label="Remark"
  description="An arbitrary string"
  client={client}
  typeId={10}
  onChange={(value) => console.log("Text:", value)}
/>

Validation

The component uses a Zod schema that accepts any string:

const schema = z.string();

Value Format

The onChange callback receives a string -- the raw text entered by the user. If the input is cleared, an empty string "" is emitted.