CheckboxList

Install

yarn add @ntds/checkbox

Import

import { CheckboxList } from '@ntds/checkbox';

Props

CheckboxList

PropType & Description
name
string

The name of the Checkbox.

value
string[]

The current state of the checkboxesc

setValue
(value: string[]) => void

Pass your setter from useState() directly here.

horizontal
boolean

If the CheckboxList should be displayed horizontally

errorMessage
string | ((id: string) => ReactNode)

Mark the input as invalid both visually and semantically

Given as a string: Will render the message inside a Message component under the CheckboxList Will not use aria-live Given as a ReactNode: Will render the content with margin dictated by the CheckboxList Use the Message component from @ntds/message

hasError
boolean

Toggle an errormessage below the CheckboxList

onChange
(event: ChangeEvent<HTMLInputElement>) => void

A callback that gets triggered when a checkbox is clicked

children
ReactNode

Usually simple text, but can be anything

This guide is based on version: 2.7.1