How to binding CheckboxGroup?

<vaadin-checkbox-group theme="vertical" id="phones" ></vaadin-checkbox-group>

private CheckboxGroup<Phone> phones;

binder.bind(phones,"phones");  ====> error

“phones” property in

Where can I refer to an example of binding Java Beans and CheckboxGroup?

Hi null yoyowon

Documentation for the CheckboxGroup seems to be missing in the [components page]

Here is what you have to do to properly use a CheckboxGroup:

  1. In your class that you want to bind (Person in this case), the used property must be a Set.
  2. in the view, define a CheckboxGroup<Phone> and set the possible options (list of phones) with checkboxGroup.setDataProvider(allOptions);
  3. Then bind the Person to the checkboxGroup using either one of these two methods:
binder.bind(checkboxGroup, "phones");
// or
    // you can add converters and or validators here
	.bind(Person::getPhones, Person::setPhones);

Here is an example code of mine showing what I described above:

@Route(value = "test)
public class TestView extends VerticalScrollLayout {
    public TestView(){
        add(new H4("Test View"));

        Person person = new Person();
        Binder<Person> binder = new Binder<>(Person.class);

        CheckboxGroup<Phone> checkboxGroup = new CheckboxGroup<>();
        // provide all options - I use an enum, but you could also provide real objects
        checkboxGroup.setDataProvider(new ListDataProvider<>(Arrays.asList(Phone.values())));

        //binder.forField(checkboxGroup).bind(Person::getPhones, Person::setPhones);
        binder.bind(checkboxGroup, "phones");

        // Button to show current selection
        Button showSelectedPhones = new Button("show current selection", click -> {
            // to proof that the binder works, I read the values from the bound person object
            String selectedPhonesString = person.getPhones().stream().map(Object::toString).collect(Collectors.joining(", "));
  "The person has these phones: "+selectedPhonesString);

    public class Person {
        private Set<Phone> phones;
        public Person(){
        public Set<Phone> getPhones() {
            return phones;
        public void setPhones(Set<Phone> phones) {
            this.phones = phones;
    public enum Phone {