@itwin/core-react
Version:
A react component library of iTwin.js UI general purpose components
56 lines • 2.63 kB
TypeScript
/** @packageDocumentation
* @module Inputs
*/
import "./NumberInput.scss";
import * as React from "react";
import { Input } from "@itwin/itwinui-react";
type InputProps = React.ComponentPropsWithoutRef<typeof Input>;
/** Step function prototype for [[NumberInput]] component
* @public
* @deprecated in 4.12.0. Interface used in a deprecated component {@link NumberInput}.
*/
export type StepFunctionProp = number | ((direction: string) => number | undefined);
/** Properties for the [[NumberInput]] component
* @public
* @deprecated in 4.12.0. Props of deprecated component {@link NumberInput}.
*/
export interface NumberInputProps extends Omit<InputProps, "min" | "max" | "step" | "onChange"> {
/** Numeric value, set to `undefined` to show placeholder text */
value?: number;
/** CSS class name for the NumberInput component container div */
containerClassName?: string;
/** Style for component container div. */
containerStyle?: React.CSSProperties;
/** number or function Number.MIN_SAFE_INTEGER */
min?: number;
/** number or function defaults to Number.MAX_SAFE_INTEGER */
max?: number;
/** increment step value used while incrementing or decrementing (up/down buttons or arrow keys) defaults to 1. */
step?: StepFunctionProp;
/** number of decimal places, defaults to 0 */
precision?: number;
/** function parseFloat */
parse?: (value: string) => number | null | undefined;
/** function optional formatting function that takes the number value and the internal formatted value in case function just adds prefix or suffix. */
format?: (num: number | null | undefined, formattedValue: string) => string;
/** Set to true to "snap" to the closest step value while incrementing or decrementing (up/down buttons or arrow keys). */
snap?: boolean;
/** Function to call when value is changed. */
onChange?: (value: number | undefined, stringValue: string) => void;
/** if true up/down buttons are shown larger and side by side */
showTouchButtons?: boolean;
/** Provides ability to return reference to HTMLInputElement */
ref?: React.Ref<HTMLInputElement>;
/**
* Makes this component behave as controlled component.
* @internal
*/
isControlled?: boolean;
}
/** Input component for numbers with up and down buttons to increment and decrement the value.
* @public
* @deprecated in 4.12.0. Use {@link https://itwinui.bentley.com/docs/input iTwinUI input} instead.
*/
export declare const NumberInput: (props: NumberInputProps) => React.ReactNode;
export {};
//# sourceMappingURL=NumberInput.d.ts.map