Skip to content

WIP: Conditionally display fields based on another field's value

License

Notifications You must be signed in to change notification settings

dillingham/nova-conditional-fields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nova Conditional Fields

Latest Version on Github Total Downloads Twitter Follow

Conditionally display fields based on another field's value

Install

composer require dillingham/nova-conditional-fields

Usage

use NovaConditionalFields\Condition;

Example using a boolean field

Boolean::make('Show Fields'),

Condition::make('Show Fields')
    ->when(true, [
        Text::make('Extra Setting 1'),
        Text::make('Extra Setting 2'),
        Text::make('Extra Setting 3'),
    ])

An example using select

Select::make('Type')->options([
    'type-1' => 'Type 1',
    'type-2' => 'Type 2',
]),

Condition::make('Type')
    ->fieldsWhen('type-1', [
        Text::make('Setting 1'),
        Text::make('Setting 2'),
        Text::make('Setting 3'),
    ])->when('type-2', [
        Text::make('Setting 4'),
        Text::make('Setting 5'),
        Text::make('Setting 6'),
    ])

Coming soon

-- BelongsTo support

-- whenTrue

-- whenNot

-- whenEmpty


Author

Hi 👋, Im Brian Dillingham, creator of this Nova package and others

Hope you find it useful. Feel free to reach out with feedback.

Follow me on twitter: @im_brian_d

About

WIP: Conditionally display fields based on another field's value

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •