Does onChange work inside Checkbox component?

Hi I’m thinking of using your product on my workflows. But I got some problem while using UI kit 2.

My setup.

  • Node: 20.10.0
  • @forge/api”: “^3.0.0”,
  • @forge/cli”: “^7.0.1”,
  • @forge/ui”: “^1.10.4”,

And I’ve tried

<Form onSubmit={handleSubmit} submitButtonText="test">
  <CheckboxGroup label="Products" name="products">
      <Checkbox value="jira" label="Jira" />
      <Checkbox
        defaultChecked
        value="confluence"
        label="Confluence"
        onChange={({ value, isChecked }) => setValue(value)}
      />
    </CheckboxGroup>
</Form>

Checkbox should be inside CheckboxGroup and CheckboxGroup should be wrapped by Form. So I’ve set the minimum configuration.

But onChange event doesn’t work when I click each checkbox.

How should I use this? Does this work? I’ve checked that submit works as described in the documentation from https://developer.atlassian.com/platform/forge/ui-kit-2/checkbox-checkboxgroup/ but onChange event doesn’t work on any case.

If you’re using UI Kit 2 you should be importing components from @forge/react (not @forge/ui)

import { Checkbox, CheckboxGroup } from "@forge/react";

1 Like

Thank you! I’d better read the docs carefully :slight_smile:

1 Like