Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created January 15, 2023 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun12209/70c087d3f5576744fd041b73701a4f60 to your computer and use it in GitHub Desktop.
Save arun12209/70c087d3f5576744fd041b73701a4f60 to your computer and use it in GitHub Desktop.
<template>
<div>
<button onclick={toggleVisibility}>Toggle</button>
<template if:true={isVisible}>
<div>This element is visible</div>
</template>
</div>
</template>
<script>
import { LightningElement, track } from 'lwc';
export default class VisibilityToggle extends LightningElement {
@track isVisible = false;
toggleVisibility() {
this.isVisible = !this.isVisible;
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment