I want to create a feature where a portion of text is displayed from a description field, and then expand to show the full text when a caret icon is clicked.
This is my current implementation, which is very close to what I envision:
<div class="card-body">
<a data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample" class="dropdown-toggle">
</a>
<div class="collapse" id="collapseExample">
<p class="card-subtitle text-muted"><%= @foo[:description] %></p>
</div>
<p class="card-subtitle text-muted text-truncate"><%= @foo[:description] %></p>
</div>
Challenges I'm facing include:
- Is it possible to make the caret rotate 90 degrees when toggling the content?
- How can I hide the truncated text when displaying the full text?
- Can the caret be positioned immediately to the left of the text rather than above it?