UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

75 lines 3.4 kB
/** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import { type ReactElement, type ReactNode } from 'react'; import { type CommonProps, type TooltipObjectProps } from '../_common/types'; import { Skeleton } from '../skeleton'; type TextInputProps = { /** Assistive text displayed below the input */ helpText?: string | ReactNode; /** Error message displayed below the input. When provided, it overrides `helpText` and shows an error icon */ errorText?: string | ReactNode; /** Leading element rendered inside the input */ leadingElement?: ReactElement; /** Trailing element rendered inside the input */ trailingElement?: ReactElement; /** Size of the input */ size?: 'small' | 'medium' | 'large'; /** Whether the input is read-only */ isReadOnly?: boolean; /** * Whether to display the Required/Optional label next to the field label. * Shows Required if isRequired is true, otherwise shows Optional. * @default false */ showRequiredOrOptionalLabel?: boolean; /** Whether the input is disabled */ isDisabled?: boolean; /** Whether the input is required */ isRequired?: boolean; /** The current value of the input */ value?: React.ComponentPropsWithoutRef<'input'>['value']; /** Placeholder text displayed when the input is empty */ placeholder?: React.ComponentPropsWithoutRef<'input'>['placeholder']; /** Callback function triggered when the input value changes */ onChange?: React.ComponentPropsWithoutRef<'input'>['onChange']; /** Whether the input should take the full available width */ isFluid?: boolean; /** Text displayed in the information tooltip shown next to the label */ moreInformationText?: React.ReactNode; /** The label displayed above the input */ label?: string | React.ReactNode; /** Props for the Tooltip component used by the information icon */ tooltipProps?: TooltipObjectProps; /** Whether to render skeletons instead of content */ isSkeletonLoading?: boolean; /** Additional props forwarded to the underlying Skeleton components */ skeletonProps?: React.ComponentProps<typeof Skeleton>; }; /** * * * TextInput Component * * */ export declare const TextInput: ({ label, isFluid, errorText, helpText, leadingElement, trailingElement, showRequiredOrOptionalLabel, moreInformationText, size, placeholder, value, tooltipProps, htmlAttributes, isDisabled, isReadOnly, isRequired, onChange, className, style, isSkeletonLoading, skeletonProps, ref, ...restProps }: CommonProps<"input", TextInputProps>) => import("react/jsx-runtime").JSX.Element; export {}; //# sourceMappingURL=TextInput.d.ts.map