UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

44 lines (43 loc) 1.39 kB
import React from "react"; import { FieldsetProps } from "../fieldset"; export interface CheckboxGroupState { readonly defaultValue?: readonly any[]; readonly value?: readonly any[]; toggleValue(value: any): void; } export declare const CheckboxGroupContext: React.Context<CheckboxGroupState | null>; export interface CheckboxGroupProps extends Omit<FieldsetProps, "onChange" | "errorPropagation" | "defaultValue" | "nativeReadOnly"> { /** * Collection of `<Checkbox/>`. */ children: React.ReactNode; /** * Controlled state for checkboxes. */ value?: any[]; /** * Default checked checkboxes. */ defaultValue?: any[]; /** * Returns current checked checkboxes in group. */ onChange?: (value: any[]) => void; } /** * A component that allows users to select one or more options from a list. * * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/checkbox) * @see 🏷️ {@link CheckboxProps} * * @example * ```jsx * <CheckboxGroup legend="Transportmiddel"> * <Checkbox value="car">Bil</Checkbox> * <Checkbox value="taxi">Drosje</Checkbox> * <Checkbox value="public">Kollektivt</Checkbox> * </CheckboxGroup> * ``` */ export declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLFieldSetElement>>; export default CheckboxGroup;