PHPackages                             billythekid/conditional-fields - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. billythekid/conditional-fields

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

billythekid/conditional-fields
==============================

Show or hide fields based on the value of other fields.

0.0.6(6y ago)138.1k1[2 issues](https://github.com/billythekid/conditional-fields/issues)MITPHPCI failing

Since Mar 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/billythekid/conditional-fields)[ Packagist](https://packagist.org/packages/billythekid/conditional-fields)[ RSS](/packages/billythekid-conditional-fields/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

NOTE:
=====

[](#note)

This plugin was a stop-gap measure. [Mats](https://github.com/mmikkel) has ported [Reasons for Craft 3](https://github.com/mmikkel/Reasons-Craft3) along with this note in the Craft Discord:

> I decided to finally port it from Craft 2, primarily to make it easier to upgrade Craft 2 sites using it. I'd avoid using it for new Craft 3 builds, since there's no guarantee it'll be possible/feasible to migrate Reasons conditionals to core conditionals, once Craft 4 drops On the other hand, "soon" is a very relative term... Back when 3.0 released, I'd never guessed it'd take 3-4 years before field layout conditionals would make it to core. Also, we still don't actually know when Craft 4 is coming out :slight\_smile:

[Brandon](https://github.com/brandonkelly) also added:

> There's been a change of plans re v4 in light of … everything. Originally v4 was to be our main focus this year, but now we don't think the timing is right for a breaking update like that. So we're working to add as many of the v4 features into v3 as we can w/out breaking things, ***hopefully including conditional fields***. It's a bit more slow going because brownfield, but we think it's the right call.

So unless you really need conditional fields I'd suggest waiting for it to come into core. If you really really need them, first use Reasons and only if you need the dumbest implementation use this. You've been warned!

Conditional Fields plugin for Craft CMS 3.x
===========================================

[](#conditional-fields-plugin-for-craft-cms-3x)

[![](src/icon.svg)](src/icon.svg)

Conditional Fields Overview
---------------------------

[](#conditional-fields-overview)

Show or hide fields or tabs of fields based on the value of other fields. PRs gratefully received.

Easy now, this is probably not all you hoped it would be when you saw it was released! That said, please post [any issues](https://github.com/billythekid/conditional-fields/issues) you're having and I'll check them out.

Conditional field layouts are coming to Craft CMS version 4 core. Craft CMS version 2 had the [Reasons plugin](https://github.com/mmikkel/Reasons-Craft) but there's nothing working for Craft 3 at the moment.

**[Reasons is back!](https://github.com/mmikkel/Reasons-Craft3) I strongly suggest using that plugin instead of this one!**

This is a very simple, very dumb, implementation of a way to get conditional field layouts in your entries etc.

If you need something complex it's almost certainly not possible with this plugin, but if you just need to show and hide some fields based on simple selections, like light switches, give it a whirl.

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.4.10 or later. It may work on earlier (^3.0) versions but I've not tested it. I haven't restricted installation to 3.4.10 so give it a go!

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require billythekid/conditional-fields

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Conditional Fields.

Using Conditional Fields
------------------------

[](#using-conditional-fields)

This plugin adds a new available field type called "Conditional".

- Choose a field to watch the value
- Choose what that value should be for this to match and un-match
- Choose whether you want to show or hide the fields based on this value
- Choose the field(s) or tab(s) that should be shown or hidden when matched/unmatched

Creating a conditional field to show/hide fields:

[![Creating a conditional field for fields](resources/img/create-conditional-field.png)](resources/img/create-conditional-field.png)

Creating a conditional field to show/hide tabs:

[![Creating a conditional field for tabs](resources/img/create-tab-conditional.png)](resources/img/create-tab-conditional.png)

To check for an entry in an entry field, use 'contains' and put the entry ID as the value.

**NOTE:** Chances are that this won't work inside a matrix block or other complicated stuff. Keep it simple.

Once your conditional field is created you can drag it in to any field layouts you want it to work in.

[![adding a conditional field to a field layout](resources/img/add-to-field-layout.png)](resources/img/add-to-field-layout.png)

The field itself is invisible to your layout. There are no settings or values to be saved in the layout view, we're just adding functionality so we hide it.

Example of showing/hiding fields:

[![Layout view showing a matching fields condition](resources/img/layout-view-with-field-matching.png)](resources/img/layout-view-with-field-matching.png)

[![Layout view showing a non-matching fields condition](resources/img/layout-view-with-field-unmatching.png)](resources/img/layout-view-with-field-unmatching.png)

Example of showing/hiding tabs:

[![Layout view showing a non-matching tabs condition](resources/img/where-is-tab-2.png)](resources/img/where-is-tab-2.png)

[![Layout view showing a matching tabs condition](resources/img/there-is-tab-2.png)](resources/img/there-is-tab-2.png)

### Dos and Don'ts

[](#dos-and-donts)

#### Do…

[](#do)

- …keep it simple where possible. Light switch fields make great 'togglers' and avoid "magic" for users.
- …add element IDs to 'contains' matches to match if an element field has that element in it.
- …remember that this is a ***visual*** show/hide. No values are changed in hidden fields, they're just shown/hidden from view. (So if it has a value before it's hidden, that value can and will be used against you in your templates!)
- …select tab names to conditionally hide a whole tab of fields.
- …report issues, or even better fork it and raise pull requests for features and fixes.

#### Don't…

[](#dont)

- …expect too much from this! It's not the most elegant solution to a problem but it kinda works ok-ish for at least some of the time.
- …put multiple IDs in the 'contains' box, that won't work, at least for now.
- …set anything that could be hidden as a required field if it doesn't have a value in it. Your element won't validate and you won't be able to see why!
- …set any "Conditional" fields (the one with the rules in it) to be required in your field layouts, these don't have any values to validate.
- …give different tabs the same name in any one layout. I mean, why would you? This will probably only toggle the first one.
- …hide the tab that the conditional field that hides the tab is on, you'll never get it back.
- …set different conditional fields to operate (show/hide) the same fields in the same layouts. Who knows what will happen‽ Bad things no doubt!

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

6

Last Release

2211d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/330170?v=4)[Billy](/maintainers/billythekid)[@billythekid](https://github.com/billythekid)

---

Top Contributors

[![billythekid](https://avatars.githubusercontent.com/u/330170?v=4)](https://github.com/billythekid "billythekid (34 commits)")

---

Tags

abandonedcmsCraftcraftcmscraft-pluginconditional-fields

### Embed Badge

![Health badge](/badges/billythekid-conditional-fields/health.svg)

```
[![Health](https://phpackages.com/badges/billythekid-conditional-fields/health.svg)](https://phpackages.com/packages/billythekid-conditional-fields)
```

###  Alternatives

[verbb/navigation

Create navigation menus for your site.

90683.7k17](/packages/verbb-navigation)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.1k](/packages/verbb-comments)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[supercool/tablemaker

Create customizable and user-defined table fields.

40141.7k](/packages/supercool-tablemaker)[pennebaker/craft-architect

CraftCMS plugin to generate content models from JSON/YAML data.

72148.5k5](/packages/pennebaker-craft-architect)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
