Is it possible to have all Matrix rows in the Control Panel entry be in the collapsed state by default?

Thanks. Lori

2 Answers 2


Inject this piece of JS in your CP and they will always be closed by default:

$('.matrixblock').each(function() {

Here's an example plugin that will inject it in the CP: https://gist.github.com/boboldehampsink/6bb9e5296977a99c39b1

  • Great to hear! What file do I add that code into?
    – Lori
    Jun 18, 2015 at 15:22
  • 1
    Its best to create a new plugin for it and make the init() function include the js. I've created a gist that should set you up: gist.github.com/boboldehampsink/6bb9e5296977a99c39b1 Jun 18, 2015 at 16:57
  • 3
    Or you could just use CP JS ;)
    – Lindsey D
    Jun 18, 2015 at 20:44
  • I can't get this working with CP JS in Craft 2 — the class is being appended but the field is still open... looks like the style needs to be changed too? [EDIT: maybe it's because the matrix field is inside a Supertable?] Apr 20, 2018 at 16:17
  • This would be handy to have just as a setting in the fieldtype.
    – Andy
    Sep 17, 2018 at 14:32

Not that I'm aware of, but this feature request and response may at least help a bit. http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/7425151--expand-collapse-all-ui-for-matrix-fields

  • While its true that this doesn't come out of the box, it easily can be done. Jun 18, 2015 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.