Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

[Feature Request] Description for CheckList items, checkboxes, radio #213

Open ziming opened 1 year ago

ziming commented 1 year ago

Feature Request

What's the feature you think Backpack should have?

Seeing is better than explaining. Basically allow specifying description that will be placed below each radio/checkbox label

https://tailwindui.com/components/application-ui/forms/radio-groups

https://tailwindui.com/components/application-ui/forms/checkboxes

Have you already implemented a prototype solution, for your own project?

No. At it's easiest I guess you can do something like this

<div>
<label>Laravel Backpack</label>
<span>{!! $field['description'] !!}</span>
</div>

Or it can go more advanced

Do you see this as a core feature or an add-on?

Core

pxpm commented 1 year ago

I like the idea, but we can't have a "field description" (we already have something similar, hint), it needs to be "option description".

I think it's a very interesting and usefull thing to have, but sure we need either: checkboxes_with_description, radio_with_description fields to don't mess previous fields API, or somehow introduce the ability to add those descriptions.

Current:

[
    'name'        => 'status',
    'label'       => 'Status',
    'type'        => 'radio',
    'options'     => [
        0 => 'Draft',
        1 => 'Published'
    ]
],

Maybe:

[
    'name'        => 'status',
    'label'       => 'Status',
    'type'        => 'radio',
    'options'     => [
        ['key' => 0, 'label' => 'Draft', 'description' => 'Some description']
        ['key' => 1, 'label' => 'Published', 'description' => 'Some description']
    ]
],

I will be moving this to the Ideas so that we can continue the discussion about it.

Cheers

tabacitu commented 1 year ago

I agree, I've needed this too at some point and rolled my own field type. I don't think this should be added to the current field types though, we should probably create new ones. Which we will anyway once we create new fields for our Livewire components, because we'll be using Tabler and it has a UI for this already: https://preview.tabler.io/form-elements.html

CleanShot 2022-10-03 at 09 03 21@2x

So let's postpone this until then.

Cheers!