I’m trying to create a custom template for the paragraph-progress-bar component.
The component I created has 2 fields: title (field_title) and percentage (field_percentage, integer field limited from 0 to 100).
How can I get the value of the field_percentage field to pass it in the width of the progress bar code?
I’m trying with style="width: {{ content.field_percentuale ~ '%'}};"
but it returns Array
.
{%
set classes = (
'paragraph',
'paragraph--type--' ~ paragraph.bundle|clean_class,
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
not paragraph.isPublished() ? 'paragraph--unpublished'
)
%}
{% block paragraph %}
<div{{ attributes.addClass(classes) }}>
{% block content %}
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: {{ content.field_percentuale ~ '%'}};" aria-valuenow="{{content.field_percentuale}}" aria-valuemin="0" aria-valuemax="100">{{ content.field_titolo }}</div>
</div>
{% endblock %}
</div>
{% endblock paragraph %}