Sha256: a1a553ebbac724717de32d82467b7725d502305b9a9ab1eeb79ad9b882268241
Contents?: true
Size: 598 Bytes
Versions: 3
Compression:
Stored size: 598 Bytes
Contents
import { Controller } from "@hotwired/stimulus" export default class extends Controller { static targets = [ "button", "tab" ] static values = { selected: String } initialize() { this.#showSelectedTab() } select(event) { this.selectedValue = event.target.dataset.value this.#showSelectedTab() } #showSelectedTab() { this.buttonTargets.forEach(element => { element.dataset.selected = element.dataset.value === this.selectedValue }) this.tabTargets.forEach(element => { element.hidden = element.dataset.value !== this.selectedValue }) } }
Version data entries
3 entries across 3 versions & 1 rubygems