mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-31 18:48:08 +00:00
* move script to scripts folder * add docfy to router and scripts * add docfy to router and scripts * fix jsdoc syntax * add component markdown files to gitignore * improve error handling for scripts * tidy up remaining jsdoc syntax * add sample jsdoc components * add known issue info * make not using multi-line components clearer * make generating docs clearer * update copy * final how to docfy cleanup * fix ts file @module syntax * fix read more syntax * make docfy typescript compatible
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
|
|
/**
|
|
* @module ToggleButton
|
|
* `ToggleButton` components are used to expand and collapse content with a toggle.
|
|
*
|
|
* @example
|
|
* <ToggleButton @isOpen={{this.showOptions}} @openLabel="Show stuff" @closedLabel="Hide the stuff" @onClick={{fn (mut this.showOptions) (not this.showOptions)}} />
|
|
* {{#if this.showOptions}}
|
|
* <div>
|
|
* <p>
|
|
* I will be toggled!
|
|
* </p>
|
|
* </div>
|
|
* {{/if}}
|
|
*
|
|
* @param {boolean} isOpen - determines whether to show open or closed label
|
|
* @param {function} onClick - fired when button is clicked
|
|
* @param {string} [openLabel=Hide options] - The message to display when the toggle is open.
|
|
* @param {string} [closedLabel=More options] - The message to display when the toggle is closed.
|
|
*/
|
|
export default class ToggleButtonComponent extends Component {
|
|
get openLabel() {
|
|
return this.args.openLabel || 'Hide options';
|
|
}
|
|
get closedLabel() {
|
|
return this.args.closedLabel || 'More options';
|
|
}
|
|
}
|