nova-toggle icon indicating copy to clipboard operation
nova-toggle copied to clipboard

Display indicator only

Open atmediauk opened this issue 6 years ago • 2 comments

Hello,

Is it possible to limit the toggle labels so that they are displayed on the forms but NOT on the index. Currently I have the following:

            Toggle::make('Status', 'status')
                ->showLabels()
                ->trueLabel('Published')
                ->falseLabel('Draft')
                ->trueValue('published')
                ->falseValue('draft'),

This works well and the labels are visible on the toggle form:

image

However due to limited space on the resource index I would like to remove the label (red boxes) so that only the indicator is shown:

image

I have been able to achieve this when I remove labels all together but would prefer not to do this.

Thank you for the package and your help, the package is really useful.

atmediauk avatar Jun 26 '19 11:06 atmediauk

Hi @atmediauk , This should be possible - it just needs a extra method to be added such as ->hideLabelOnIndex()

This would be a boolean that is also checked as to whether to show a label or not. IndexField.vue needs a bit of extra logic to check for this.

If you could PR this then I can bring it in :) Alas right now I might not get a chance till August to implement this myself.

D

davidpiesse avatar Jun 26 '19 11:06 davidpiesse

I am currently working on the new version for the latest upcoming Nova version (v4) which will use Vue 3; and I will be implementing Headless UI's toggle. https://headlessui.dev/vue/switch

This is something I will look into including in the package.

davidpiesse avatar Apr 16 '21 07:04 davidpiesse