twill icon indicating copy to clipboard operation
twill copied to clipboard

feat: added clearable method to select form field

Open zeezo887 opened this issue 1 year ago • 3 comments

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

zeezo887 avatar May 06 '24 19:05 zeezo887

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

Tofandel avatar May 10 '24 12:05 Tofandel

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

Tofandel avatar May 27 '24 10:05 Tofandel

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 avatar Jun 04 '24 23:06 ifox