PHPackages                             goldnead/statamic-collapse-fieldtype - 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. goldnead/statamic-collapse-fieldtype

ActiveStatamic-addon[Utility &amp; Helpers](/categories/utility)

goldnead/statamic-collapse-fieldtype
====================================

A Collapse-Fieldtype for Statamic to beautifully hide and show your fields.

v1.1(1y ago)288.0k↓25%3[1 PRs](https://github.com/goldnead/statamic-collapse-fieldtype/pulls)MITVuePHP ^7.3|^8.0|^8.1|^8.2|^8.3

Since Sep 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/goldnead/statamic-collapse-fieldtype)[ Packagist](https://packagist.org/packages/goldnead/statamic-collapse-fieldtype)[ RSS](/packages/goldnead-statamic-collapse-fieldtype/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (9)Used By (0)

statamic-collapse-fieldtype
===========================

[](#statamic-collapse-fieldtype)

A Collapse-Fieldtype for Statamic to beautifully hide and show your fields.

Simple as that. Just tuck all the fields that take up too much space or you don't want to confuse your clients with et voilá: A beautiful little collapse-content section wherever you want that hides bloated fields.

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

[](#installation)

```
composer require goldnead/statamic-collapse-fieldtype

```

That's it. No vendors-assets needing attention or config files waiting to be configured. Just a plain ol' Fieldtype, nuthin' more.

Usage
-----

[](#usage)

Behind the scenes this fieldtype kind of works like a `grid` or `replicator` fieldtype. Just without the repetition. Even conditions work! Just use it in your fieldsets or blueprints like this:

```
title: 'Content Theme'
fields:
  -
    handle: collapse
    field:
      fields:
        -
          handle: toggle_field
          field:
            default: false
            display: 'Test conditional fields!'
            type: toggle
            icon: toggle
            width: 50
            listable: hidden
        -
          handle: advanced_settings
          field:
            display: 'Advanced Settings'
            type: section
            icon: section
            listable: hidden
            if:
              toggle_field: 'equals true'
        -
          handle: section_width
          field:
            options:
              sm: SM
              md: MD
              lg: LG
              custom: Custom
            default: md
            display: 'Section Width'
            type: button_group
            icon: button_group
            width: 75
            listable: hidden
        -
          handle: custom_width
          field:
            default: '450'
            display: 'Custom Width'
            type: integer
            icon: integer
            width: 25
            listable: hidden
            if:
              section_width: 'equals custom'
      display: 'Collapse This!'
      type: collapse
      icon: asection
      listable: hidden
      instructions: "When you click here, something great will happen."
```

Easy-peasy, right? You can also just use it in the blueprint editor.

Templating
----------

[](#templating)

Like in the `grid` fieldset all values are scoped within that field. So to acces the variable `section_width` from the example above we need to write something like this in our templates:

```
