UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

27 lines (26 loc) 1.34 kB
import type { MouseEvent, RefObject } from 'react'; import type { FieldStringProps as StringFieldProps } from '../String'; import type { InputProps } from '../../../../components/Input'; export type PasswordVisibilityEvent = MouseEvent<HTMLButtonElement> & { value: string; }; export type PasswordProps = Omit<StringFieldProps, 'ref'> & { /** * Will be called when the user toggles the password to be visible. */ onShowPassword?: (event: PasswordVisibilityEvent) => void; /** * Will be called when the user toggles the password to be hidden. */ onHidePassword?: (event: PasswordVisibilityEvent) => void; /** * The sizes you can choose are `small` (1.5rem), `default` (2rem), `medium` (2.5rem) and `large` (3rem). Defaults to `default` / `null`. Also, if you define a number like `size="2"` then it will be forwarded as the input element attribute. Consider rather setting field sizes with [Form.Appearance](/uilib/extensions/forms/Form/Appearance/). */ size?: InputProps['size']; /** * `ElementRef` passed on to the password `input` element. */ ref?: RefObject<HTMLInputElement>; }; declare function Password({ id, className, ref: refProp, value, label, disabled, size, ...props }: PasswordProps): import("react/jsx-runtime").JSX.Element; export default Password;