ability to force close a accordion item #2227
Unanswered
olivM
asked this question in
Feature Requests
Replies: 1 comment 6 replies
-
|
@olivM You can <?php
use Livewire\Volt\Component;
new class extends Component
{
public bool $isExpanded = false;
public function toggleExpanded(): void
{
$this->isExpanded = ! $this->isExpanded;
}
};
?>
<div>
<flux:button size="sm" wire:click="toggleExpanded">
Toggle Expanded
</flux:button>
<flux:accordion class="mt-6">
<flux:accordion.item>
<flux:accordion.heading>What's your refund policy?</flux:accordion.heading>
<flux:accordion.content>
If you are not satisfied with your purchase, we offer a 30-day money-back guarantee. Please contact our support team for assistance.
</flux:accordion.content>
</flux:accordion.item>
<flux:accordion.item wire:model="isExpanded">
<flux:accordion.heading>Do you offer any discounts for bulk purchases?</flux:accordion.heading>
<flux:accordion.content>
Yes, we offer special discounts for bulk orders. Please reach out to our sales team with your requirements.
</flux:accordion.content>
</flux:accordion.item>
<flux:accordion.item>
<flux:accordion.heading>How do I track my order?</flux:accordion.heading>
<flux:accordion.content>
Once your order is shipped, you will receive an email with a tracking number. Use this number to track your order on our website.
</flux:accordion.content>
</flux:accordion.item>
</flux:accordion>
</div> |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
it's possible to force expanded an item with the 'expanded' attribute
but if the user has manually expanded an item, it's not possible to force close ( from a livewire property )
Beta Was this translation helpful? Give feedback.
All reactions