Perseus
    Preparing search index...

    The NumericInput widget is a numeric input field that supports a variety of answer forms, including integers, decimals, fractions, and mixed numbers.

    [Jan 2025] We're currenly migrating from class-based components to functional components. While we cannot fully migrate this component yet, we can start by using the functional component for the rendering the UI of the widget.

    Hierarchy

    Implements

    Index

    Constructors

    Properties

    blurInputPath: () => void = ...
    focus: () => boolean = ...
    focusInputPath: () => void = ...
    getInputPaths: () => readonly (readonly string[])[] = ...
    inputRef: RefObject<Focusable> = ...
    defaultProps: DefaultProps = ...

    Methods

    • Returns {
          alignment: string | null | undefined;
          answerForms: readonly PerseusNumericInputAnswerForm[];
          apiOptions: APIOptionsWithDefaults;
          coefficient: boolean;
          containerSizeClass: SizeClass;
          currentValue: string;
          findWidgets: (criterion: FilterCriterion) => readonly Widget[];
          handleUserInput: (
              newUserInput: PerseusNumericInputUserInput,
              cb?: () => void,
              silent?: boolean,
          ) => void;
          keypadElement?: any;
          labelText: string;
          linterContext: LinterContextProps;
          onBlur: (blurPath: FocusPath) => void;
          onFocus: (blurPath: FocusPath) => void;
          problemNum: number | null | undefined;
          reviewMode: boolean;
          rightAlign: boolean;
          showSolutions?: ShowSolutions;
          size: string;
          static: boolean;
          trackInteraction: (extraData?: Empty) => void;
          widgetId: string;
          widgetIndex: number;
      }

      • alignment: string | null | undefined
      • answerForms: readonly PerseusNumericInputAnswerForm[]
      • apiOptions: APIOptionsWithDefaults
      • coefficient: boolean

        A coefficient style number allows the student to use - for -1 and an empty string to mean 1.

      • containerSizeClass: SizeClass
      • currentValue: string
      • findWidgets: (criterion: FilterCriterion) => readonly Widget[]
      • handleUserInput: (
            newUserInput: PerseusNumericInputUserInput,
            cb?: () => void,
            silent?: boolean,
        ) => void
      • OptionalkeypadElement?: any
      • labelText: string

        Translatable Text; Text to describe this input. This will be shown to users using screenreaders.

      • linterContext: LinterContextProps
      • onBlur: (blurPath: FocusPath) => void
      • onFocus: (blurPath: FocusPath) => void
      • problemNum: number | null | undefined
      • reviewMode: boolean
      • rightAlign: boolean

        Whether to right-align the text or not

      • OptionalshowSolutions?: ShowSolutions
      • size: string

        Use size "Normal" for all text boxes, unless there are multiple text boxes in one line and the answer area is too narrow to fit them. Options: "normal" or "small"

      • static: boolean

        Always false. Not used for this widget

      • trackInteraction: (extraData?: Empty) => void
      • widgetId: string
      • widgetIndex: number

      and likely very broken API [LEMS-3185] do not trust serializedState