On Selects is it possible to make the createOptionForm button clearer

On Selects is it possible to make the createOptionForm button clearer or have it as a standalone button below the select? Some users are missing it as it’s not that obvious.
No description
7 Replies
awcodes
awcodes9mo ago
Maybe do a hint action instead?
Ric Le Poidevin
Ric Le PoidevinOP9mo ago
What do you mean? 🙂
awcodes
awcodes9mo ago
You can do ->hintAction(). But just realized it a createOptionForm(). But it can still be achieved with a hintAction() Will just require a little more work.
Ric Le Poidevin
Ric Le PoidevinOP9mo ago
Ok, thank you, I will investigate!
Ric Le Poidevin
Ric Le PoidevinOP9mo ago
For anyone looking at how to do this with a hintAction
Forms\Components\Select::make('Contact')
->label('Primary contact')
->relationship('contact', 'name')
->hintAction(
Action::make('Add contact')
->icon('heroicon-m-user-plus')
->form(fn(Form $form) => ContactResource::form($form))
->action(function ($data) {
// do anything you need with your data here
$data['company_id'] = auth()->user()->current_company_id;

$contact = new Contact($data);
$contact->save();
}),
),
Forms\Components\Select::make('Contact')
->label('Primary contact')
->relationship('contact', 'name')
->hintAction(
Action::make('Add contact')
->icon('heroicon-m-user-plus')
->form(fn(Form $form) => ContactResource::form($form))
->action(function ($data) {
// do anything you need with your data here
$data['company_id'] = auth()->user()->current_company_id;

$contact = new Contact($data);
$contact->save();
}),
),
@awcodes thanks, this worked, anywhere I can make a feature request as I think have some customisability over the display of the select create button would be valuable
awcodes
awcodes9mo ago
You can do feature requests on the GitHub repo. Glad it worked for you. 🙂
Want results from more Discord servers?
Add your server