#StandWithUkraine

Controlled Inputs

The GDS components are often used as controlled inputs. This guide demonstrates how to achieve that.

CheckboxInput

When dealing with indeterminate CheckboxInputs one has to remember that indeterminate state is orthogonal to value. In other words an indeterminate CheckboxInput is still either checked or unchecked.

The following example controls both props. Of course, when you do not need an indeterminate CheckboxInput you do not have to store the indetermination state and you can simplify the code.

Loading demo…