Sha256: b59db98349a638aa588effe7509a56c36374e70c1128e993e912b6796117506c

Contents?: true

Size: 558 Bytes

Versions: 15

Compression:

Stored size: 558 Bytes

Contents

import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
  static targets = ["item"];
  static classes = ["hidden"];

  connect() {
    this.class = this.hasHiddenClass ? this.hiddenClass : "hidden";
  }

  toggle() {
    this.itemTargets.forEach((item) => {
      item.classList.toggle(this.class);
    });
  }

  show() {
    this.itemTargets.forEach((item) => {
      item.classList.remove(this.class);
    });
  }

  hide() {
    this.itemTargets.forEach((item) => {
      item.classList.add(this.class);
    });
  }
}

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
shadcn-ui-0.0.15 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.14 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.13 app/javascript/controllers/ui/collapsible_controller.js
rails_live_dashboard-0.2.0 app/assets/javascripts/rails_live_dashboard/controllers/reveal_controller.js
rails_live_dashboard-0.1.2 app/assets/javascripts/rails_live_dashboard/controllers/reveal_controller.js
rails_live_dashboard-0.1.1 app/assets/javascripts/rails_live_dashboard/controllers/reveal_controller.js
rails_live_dashboard-0.1.0 app/assets/javascripts/rails_live_dashboard/controllers/reveal_controller.js
shadcn-ui-0.0.12 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.10 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.8 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.5 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.4 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.3 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.2 app/javascript/controllers/ui/collapsible_controller.js
shadcn-ui-0.0.1 app/javascript/controllers/ui/collapsible_controller.js