@porsche-design-system/components-react
Version:
Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.
213 lines (212 loc) • 7.6 kB
TypeScript
import type { BaseProps } from '../../BaseProps';
import type { BreakpointCustomizable, InputNumberBlurEventDetail, InputNumberChangeEventDetail, InputNumberInputEventDetail, InputNumberState } from '../types';
export type PInputNumberProps = BaseProps & {
/**
* Provides the browser with a data type hint to enable relevant autofill suggestions (e.g. `autocomplete='postal-code'`).
*/
autoComplete?: string;
/**
* Reduces the input height and padding for a more compact layout.
* @default false
*/
compact?: boolean;
/**
* Shows increment/decrement spin buttons inside the field to adjust the numeric value by clicking.
* @default false
*/
controls?: boolean;
/**
* Sets a supplementary description displayed below the label to provide additional context.
* @default ''
*/
description?: string;
/**
* Disables the field, preventing all input. The value is not submitted with the form.
* @default false
*/
disabled?: boolean;
/**
* Associates the field with a form element by its ID when the field is not nested directly inside it.
*/
form?: string;
/**
* Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values.
* @default false
*/
hideLabel?: BreakpointCustomizable<boolean>;
/**
* Sets the visible label text displayed above the input field.
* @default ''
*/
label?: string;
/**
* @experimental Disables the field and displays a loading spinner to indicate an ongoing operation.
* @default false
*/
loading?: boolean;
/**
* Sets the maximum allowed numeric value. Values above this are invalid.
*/
max?: number;
/**
* Sets the validation feedback message displayed below the field when `state` is `success` or `error`.
* @default ''
*/
message?: string;
/**
* Sets the minimum allowed numeric value. Values below this are invalid.
*/
min?: number;
/**
* Sets the name submitted with the form data to identify this field's value on the server.
*/
name: string;
/**
* Emitted when the number input has lost focus.
*/
onBlur?: (event: CustomEvent<InputNumberBlurEventDetail>) => void;
/**
* Emitted when the number input loses focus after its value was changed.
*/
onChange?: (event: CustomEvent<InputNumberChangeEventDetail>) => void;
/**
* Emitted when the value has been changed as a direct result of a user action.
*/
onInput?: (event: CustomEvent<InputNumberInputEventDetail>) => void;
/**
* Sets placeholder text shown inside the field when it is empty, to hint at the expected format.
* @default ''
*/
placeholder?: string;
/**
* Makes the field read-only — the value is displayed but cannot be edited. The value is still submitted with the form.
* @default false
*/
readOnly?: boolean;
/**
* Marks the field as required — form submission is blocked while this field is empty.
* @default false
*/
required?: boolean;
/**
* Sets the validation state, controlling the visual appearance and style of the feedback message (`none`, `success`, `error`).
* @default 'none'
*/
state?: InputNumberState;
/**
* Sets the stepping granularity — the value must be a multiple of this number. Also controls step button increment size.
* @default 1
*/
step?: number;
/**
* Sets the current numeric value of the field.
* @default ''
*/
value?: string | number | null;
};
export declare const PInputNumber: import("react").ForwardRefExoticComponent<Omit<import("react").DOMAttributes<{}>, "onChange" | "onInput" | "onToggle"> & Pick<import("react").HTMLAttributes<{}>, "suppressHydrationWarning" | "autoFocus" | "className" | "dir" | "hidden" | "id" | "inert" | "inputMode" | "lang" | "slot" | "style" | "tabIndex" | "title" | "translate" | "role"> & {
/**
* Provides the browser with a data type hint to enable relevant autofill suggestions (e.g. `autocomplete='postal-code'`).
*/
autoComplete?: string;
/**
* Reduces the input height and padding for a more compact layout.
* @default false
*/
compact?: boolean;
/**
* Shows increment/decrement spin buttons inside the field to adjust the numeric value by clicking.
* @default false
*/
controls?: boolean;
/**
* Sets a supplementary description displayed below the label to provide additional context.
* @default ''
*/
description?: string;
/**
* Disables the field, preventing all input. The value is not submitted with the form.
* @default false
*/
disabled?: boolean;
/**
* Associates the field with a form element by its ID when the field is not nested directly inside it.
*/
form?: string;
/**
* Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values.
* @default false
*/
hideLabel?: BreakpointCustomizable<boolean>;
/**
* Sets the visible label text displayed above the input field.
* @default ''
*/
label?: string;
/**
* @experimental Disables the field and displays a loading spinner to indicate an ongoing operation.
* @default false
*/
loading?: boolean;
/**
* Sets the maximum allowed numeric value. Values above this are invalid.
*/
max?: number;
/**
* Sets the validation feedback message displayed below the field when `state` is `success` or `error`.
* @default ''
*/
message?: string;
/**
* Sets the minimum allowed numeric value. Values below this are invalid.
*/
min?: number;
/**
* Sets the name submitted with the form data to identify this field's value on the server.
*/
name: string;
/**
* Emitted when the number input has lost focus.
*/
onBlur?: (event: CustomEvent<InputNumberBlurEventDetail>) => void;
/**
* Emitted when the number input loses focus after its value was changed.
*/
onChange?: (event: CustomEvent<InputNumberChangeEventDetail>) => void;
/**
* Emitted when the value has been changed as a direct result of a user action.
*/
onInput?: (event: CustomEvent<InputNumberInputEventDetail>) => void;
/**
* Sets placeholder text shown inside the field when it is empty, to hint at the expected format.
* @default ''
*/
placeholder?: string;
/**
* Makes the field read-only — the value is displayed but cannot be edited. The value is still submitted with the form.
* @default false
*/
readOnly?: boolean;
/**
* Marks the field as required — form submission is blocked while this field is empty.
* @default false
*/
required?: boolean;
/**
* Sets the validation state, controlling the visual appearance and style of the feedback message (`none`, `success`, `error`).
* @default 'none'
*/
state?: InputNumberState;
/**
* Sets the stepping granularity — the value must be a multiple of this number. Also controls step button increment size.
* @default 1
*/
step?: number;
/**
* Sets the current numeric value of the field.
* @default ''
*/
value?: string | number | null;
} & {
children?: import("react").ReactNode | undefined;
} & import("react").RefAttributes<HTMLElement>>;