Altinn / Altinn/app-frontend-react

New component: `Checkbox` (not `Checkboxes`)

Open
#681 0 comments 0 reactions 0 assignees View on GitHub
kind/feature-request status/draft
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

### Description

The current `Checkboxes` component allows you to add just one checkbox if you want, but while it's natural wanting to bind that to a `boolean` field in the data model, that does not work.

Boolean bindings does not work for two reasons:
- #205
- The current expectation for the `simpleBinding` in `Checkboxes` is to store (multiple) values for all the checked checkboxes as comma-separated strings.

We have no separate component for 'just one checkbox', so this issue describes that.

### Other considerations
Should we also make components for binding two radio-buttons (yes/no) to a boolean in the data model? And a component displayed as a dropdown? Maybe one component to rule them all, with a `mode` to change how the component should be visually presented.

### Additional Information

- #114
- https://github.com/Altinn/app-frontend-react/issues/114#issuecomment-1197484536
- #205 (required for this to work)
- #273
- Slack discussion: https://altinndevops.slack.com/archives/C02MUCFNC02/p1668684113821689

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing `Checkboxes` component and the linked issues, especially #205, #114, and #273. Clarify whether the scope is a separate boolean-bound `Checkbox` or also radio-button and dropdown variants. Done means the agreed component supports binding a single checkbox to a boolean data-model field.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.