UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

39 lines (38 loc) 1.12 kB
import React, { InputHTMLAttributes } from "react"; import { FormFieldProps } from "../useFormField"; export interface SwitchProps extends Omit<FormFieldProps, "error" | "errorId">, Omit<InputHTMLAttributes<HTMLInputElement>, "size"> { /** * Switch-label. */ children: React.ReactNode; /** * If enabled shows the label and description for screenreaders only. */ hideLabel?: boolean; /** * Toggles loading state with loader-component on switch. */ loading?: boolean; /** * Positions switch on left/right side of label. * @default "left" */ position?: "left" | "right"; /** * Adds a description to extend labeling of Switch. */ description?: string; } /** * A component that displays a switch input field. * * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/switch) * @see 🏷️ {@link SwitchProps} * * @example * ```jsx * <Switch>Varsle med SMS</Switch> * ``` */ export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>; export default Switch;