Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-select Checkbox #965

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Multi-select Checkbox #965

wants to merge 17 commits into from

Conversation

kvnn
Copy link
Contributor

@kvnn kvnn commented May 6, 2024

Screenshot_2024-05-08_at_9 39 44_AM

This adds a multi-select checkbox type , similar to Actions:

    options = [
        cl.CheckboxGroupOption(name='townhouse', value='townhouse', label='townhouse'),
        cl.CheckboxGroupOption(name='condo', value='condo', label='condo'),
        cl.CheckboxGroupOption(name='single_family', value='single_family', label='single_family'),
        cl.CheckboxGroupOption(name='multi_family', value='multi_family', label='multi_family'),
        cl.CheckboxGroupOption(name='land', value='land', label='land'),
        cl.CheckboxGroupOption(name='other', value='other', label='other')
    ]

    checkbox_group = cl.CheckboxGroup(
        name=current_model.__tablename__,
        options=options
    )

    res = await cl.AskCheckboxMessage(
        content=message,
        checkbox_group=checkbox_group
    ).send()
 
    if res:
        print(res['selected'])
        selected_names = [option['name'] for option in res['selected']]

@kvnn kvnn marked this pull request as draft May 6, 2024 01:42
@kvnn kvnn marked this pull request as ready for review May 9, 2024 20:04
@willydouhard
Copy link
Collaborator

This is interesting! Two feedback:

  1. It would be nice to have a test for this (you can look at the AskAction test for instance)
  2. The save button taking the whole width seems a bit too much. Maybe auto width and aligned to the right or left?

@kvnn
Copy link
Contributor Author

kvnn commented May 11, 2024

@willydouhard Done.

Screenshot 2024-05-10 at 2 05 09 PM Screenshot 2024-05-10 at 2 05 56 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants