@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
43 lines (42 loc) • 1.3 kB
TypeScript
import React, { InputHTMLAttributes } from "react";
import { FormFieldProps } from "../useFormField";
export interface TextFieldProps extends FormFieldProps, Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
/**
* Controlled value
*/
value?: string | number;
/**
* Defaults input-value without needing controlled-state
*/
defaultValue?: string | number;
/**
* Exposes the HTML size attribute
*/
htmlSize?: number;
/**
* If enabled shows the label and description for screenreaders only
*/
hideLabel?: boolean;
/**
* TextField label
*/
label: React.ReactNode;
/**
* Type of form control. Picking the correct type helps user fill inn their required information
* @default "text"
*/
type?: "email" | "number" | "password" | "tel" | "text" | "url" | "time";
}
/**
* A component that displays a text input field with a label.
*
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/textfield)
* @see 🏷️ {@link TextFieldProps}
*
* @example
* ```jsx
* <TextField label="Har du noen tilbakemeldinger?" />
* ```
*/
export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
export default TextField;