I have the following code snippet in a razor component:
@{
var id = $"collapseNotes{itemId}";
var href = $"#{id}";
<div>
<i class="fas fa-angle-right"></i>
<a data-toggle="collapse" href="@(href)" role="link" aria-expanded="false" aria-controls="@(id)">
More info
</a>
<div class="collapse pl-3 pr-3" id="@(id)">
<p>long text...</p>
</div>
</div>
}
The collapsing and expanding functionality is working as expected.
However, I am looking to change the icon when expanding and then revert back to the original state when collapsed.
Is this achievable with just CSS or do I need to use JavaScript? Either way, what would be the recommended best practice for implementation?