Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: added clearable method to select form field #2581

Merged
merged 5 commits into from
Oct 15, 2024

Conversation

zeezo887
Copy link
Collaborator

@zeezo887 zeezo887 commented May 6, 2024

Description

Allows the user to clear the selected option:

Select::make()
  ->name('field')
  ->options(
      Options::make([
          Option::make('value', 'label'),
          Option::make('value2', 'label2'),
      ])
  )
  ->clearable()

Related Issues

Fixes #2562

@Tofandel
Copy link
Contributor

I think clearable makes more sense, then we could show a clear button on the select input

@Tofandel
Copy link
Contributor

Tofandel commented May 27, 2024

There seems to be already what is needed on the VSelect component to make it work https://github.com/area17/twill/blob/3.x/frontend/js/components/VSelect/ExtendedVSelect.vue#L42-L44C7

But it seems it's not the component that is used https://github.com/area17/twill/blob/3.x/frontend/js/components/SingleSelect.vue

@ifox
Copy link
Member

ifox commented Jun 4, 2024

I implemented clearable instead as discussed. By default the Select field does use vue-select. It doesn't only if unpack or native are true.

@ifox ifox changed the title feat: added method to add an empty option to select form field feat: added clearable method to select form field Jun 4, 2024
@ifox ifox added this to the Twill 3.4 milestone Jun 4, 2024
@ifox ifox added the type: enhancement New feature or request label Jun 4, 2024
@ifox ifox merged commit 60af476 into area17:3.x Oct 15, 2024
8 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't unselect option from Select (form field)
3 participants