Title: Conditional controls
Last modified: August 24, 2016

---

# Conditional controls

 *  Resolved [Daniel](https://wordpress.org/support/users/puntofape/)
 * (@puntofape)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-controls/)
 * Hi,
 * How can I do a conditional control?
 * Ex:
 * if checkbox is checked –> show a select
    if checkbox is not checked –> hide a
   select
 * [https://wordpress.org/plugins/kirki/](https://wordpress.org/plugins/kirki/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Dimitris Kalliris](https://wordpress.org/support/users/fovoc/)
 * (@fovoc)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-controls/#post-6048956)
 * Hey there,
 * you can use a ‘required’ argument in select control as follows
 *     ```
       $controls[] = array(
       		'type'        => 'select',
       		'setting'     => 'select_demo_2',
       		'label'       => __( 'This is the label', 'kirki' ),
       		'description' => __( 'This is the control description', 'kirki' ),
       		'help'        => __( 'This is some extra help. You can use this to add some additional instructions for users. The main description should go in the "description" of the field, this is only to be used for help tips.', 'kirki' ),
       		'section'     => 'select_section',
       		'default'     => 'option-1',
       		'priority'    => 10,
       		'choices'     => array(
       			'option-1' => __( 'Option 1', 'kirki' ),
       			'option-2' => __( 'Option 2', 'kirki' ),
       			'option-3' => __( 'Option 3', 'kirki' ),
       			'option-4' => __( 'Option 4', 'kirki' ),
       		),
       		'required' => array(
       			array(
       				'setting' => 'checkbox_demo',
       				'operator' => '==',
       				'value' => 1
       			)
       		)
       	);
       ```
   
 * Hope that helps,
    Dimitris
 *  Thread Starter [Daniel](https://wordpress.org/support/users/puntofape/)
 * (@puntofape)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-controls/#post-6048964)
 * Thanks! works like a charm 🙂
 *  [rysan](https://wordpress.org/support/users/rysan/)
 * (@rysan)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-controls/#post-6049004)
 * Show/hide conditions work!
 * Now, how to make so that default value (#000) is applied only if checkbox has
   been ticked?
 *     ```
       $fields[] = array(
               'type'        => 'checkbox',
               'setting'     => 'cta_border_color_on',
               'label'       => __( 'Include Border', 'tourtiger' ),
               'section'     => 'hero_area_cta',
               'default'     => 0,
               'priority'    => 29,
           );
   
           $fields[] = array(
               'type'        => 'color',
               'setting'     => 'cta_border_color',
               'label'       => __( 'Border Color', 'tourtiger' ),
               'section'     => 'hero_area_cta',
               'default'     => '#000',
               'priority'    => 29,
               'required'  =>  array(
                   array(
                       'setting'   =>  'cta_border_color_on',
                       'operator'  =>  '==',
                       'value' =>  1
                   )
               ),
               'output' => array(
                   array(
                   'element'  => '.btn',
                   'property' => 'border-color',
                   ),
               )
           );
       ```
   
 *  [Dimitris Kalliris](https://wordpress.org/support/users/fovoc/)
 * (@fovoc)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-controls/#post-6049018)
 * The ‘required’ argument just hides the control until the dependencies are being
   met.
    In order to do so, you should remove the ‘output’ argument and use that
   logic and CSS in a custom function.
 * Of course, this can be a matter of debate, as a feature request. You can always
   use github’s issue tracker for proposals. 🙂
 * Cheers,
    Dimitris

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Conditional controls’ is closed to new replies.

 * ![](https://ps.w.org/kirki/assets/icon-256x256.jpg?rev=3518366)
 * [Kirki – Freeform Page Builder, Website Builder & Customizer](https://wordpress.org/plugins/kirki/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kirki/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kirki/)
 * [Active Topics](https://wordpress.org/support/plugin/kirki/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kirki/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kirki/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Dimitris Kalliris](https://wordpress.org/support/users/fovoc/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/conditional-controls/#post-6049018)
 * Status: resolved