UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

53 lines (52 loc) 1.27 kB
import React from "react"; export interface FormFieldProps { /** * Error message. */ error?: React.ReactNode; /** * Override internal errorId. */ errorId?: string; /** * Changes font-size, padding and gaps. */ size?: "medium" | "small"; /** * **Avoid using if possible for accessibility purposes**. * * Disables element. */ disabled?: boolean; /** * Adds a description to extend the labeling. */ description?: React.ReactNode; /** * Override internal id. */ id?: string; /** * Read-only state. */ readOnly?: boolean; } export interface FormFieldType { showErrorMsg: boolean; hasError: boolean; errorId: string; inputDescriptionId: string; size: "small" | "medium"; inputProps: { id: string; "aria-invalid"?: boolean; "aria-describedby"?: string; disabled?: boolean; }; readOnly?: boolean; } /** * Handles props and their state for various form-fields in context with Fieldset */ export declare const useFormField: (props: FormFieldProps, prefix: string) => FormFieldType; export declare function containsReadMore(children: React.ReactNode, checkNested?: boolean): boolean;