Charts
API reference

Inputs

Types of the input builders and input definitions.

See Inputs.

Prop

Type

/**
 * One setting of a script. The settings UI is generated from these and the
 * values are saved per chart. `default` also fixes the value's type in
 * `ctx.inputs`.
 */
export type InputDef =
  | ({ readonly kind: "Int"; readonly default: number } & NumberBounds & InputBase)
  | ({ readonly kind: "Float"; readonly default: number } & NumberBounds & InputBase)
  | ({ readonly kind: "Bool"; readonly default: boolean } & InputBase)
  | ({ readonly kind: "String"; readonly default: string } & InputBase)
  /** CSS color. */
  | ({ readonly kind: "Color"; readonly default: string } & InputBase)
  | ({
      readonly kind: "Select";
      readonly default: string;
      readonly options: readonly string[];
    } & InputBase)
  /** A price. The settings offer to pick it on the chart. */
  | ({ readonly kind: "Price"; readonly default: number } & InputBase)
  /** Epoch ms. The settings offer to pick it on the chart. */
  | ({ readonly kind: "Time"; readonly default: number } & InputBase)
  /** Symbol code, e.g. `"NQ"`. */
  | ({ readonly kind: "Symbol"; readonly default: string } & InputBase)
  | ({ readonly kind: "Timeframe"; readonly default: Timeframe } & InputBase)
  /** Passes to `g.line` as is. The settings offer solid, dashed and dotted. */
  | ({ readonly kind: "LineStyle"; readonly default: LineStyle } & InputBase);