Comment

Comment Thread Example

Comment is a standalone component

Peter Svensson
2 år

This is a comment text

Peter Olsson
Peter Olsson
1 år

This is a reply comment text

Peter Olsson
Peter Olsson
just now

This is a reply comment text, it was written now.

Peter Olsson
Peter Olsson
2 minuter

This is a reply comment text, it was written two minutes ago.

Peter Olsson
Peter Olsson
5 timmar

This is a reply comment text, it was written five hours ago.

PS
Peter Svensson
1 år
This comment content was sent through the slot.
<div class="c-comment"  data-uid="678b0d07be245">

    <div class="c-comment__col">
            <!-- avatar.blade.php -->

    <div class="c-avatar c-avatar--size-md" data-uid="678b0d07be2c0">
        
        
        
        
                    <span class="c-avatar__icon" aria-label="Peter Svensson">
                    <!-- icon.blade.php -->
    <span class="c-icon c-icon--size-lg c-icon--face c-icon--material c-icon--material-face material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-inherit" material-symbol="face" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" aria-hidden="false" data-uid="678b0d07be303">
                    </span>
            </span>
        
        
                
    </div>

    </div>

    <div class="c-comment__col">

        <div class="c-comment__top">

                <a class="c-link c-comment__link" id="" href="#" target="_top" data-uid="678b0d07be3c7">
        <!-- typography.blade.php   original: h6 -->
<h2 class="c-typography c-comment__author c-typography__variant--h2" data-uid="678b0d07be36f">
    Peter Svensson
</h2>
    </a>
    
                                <!-- typography.blade.php   original: span -->
<span class="c-typography c-comment__date c-typography__variant--meta" data-uid="678b0d07be529">
    <span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="678b0d07be4ab" data-uid="678b0d07be4ab">
    <div class="c-tooltip__wrapper" tabindex="1" aria-describedby="678b0d07be4ab">
            <!-- typography.blade.php   original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="678b0d07be4ec">
    2 år
</strong>                    <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="678b0d07be4ab">
             
            <div class="c-tooltip__content">
                <time class="2022-07-14T20:57:47 c-date" data-uid="678b0d07be44b">Thu 14 Jul 2022</time>
            </div>
            <span class="c-tooltip__arrow"></span>
                    </div>
    </div>
</span>
</span>                    </div>
    
        <div class="c-comment__bubble c-comment__bubble--color-dark">
                                <!-- typography.blade.php   original: p -->
<p class="c-typography c-comment__bubble--inner c-typography__variant--body" data-uid="678b0d07be55a">
    This is a comment text
</p>                
                    </div>

                    <div class="c-comment__actions">
                <a class="c-button c-button__basic c-button__basic--default c-button--sm" target="_top" type="button" href="#reply" aria-label="Reply" data-uid="678b0d07bdf9b">   
     <span class="c-button__label">                     <span class="c-button__loader"></span>
                            <span class="c-button__label-icon ">
                    <!-- icon.blade.php -->
    <span class="c-icon c-icon--reply c-icon--material c-icon--material-reply material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-sm" aria-hidden="false" material-symbol="reply" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" data-uid="678b0d07be0f3">
                    </span>
            </span>
        
                    <span class="c-button__label-text ">
                Reply
            </span>
        
    </span> </a>
            <a class="c-button c-button__basic c-button__basic--default c-button--sm" target="_top" type="button" href="#like" aria-label="Like" data-uid="678b0d07be15d">   
     <span class="c-button__label">                     <span class="c-button__loader"></span>
                            <span class="c-button__label-icon ">
                    <!-- icon.blade.php -->
    <span class="c-icon c-icon--thumb-up c-icon--material c-icon--material-thumb_up material-symbols material-symbols-rounded material-symbols-sharp material-symbols-outlined  c-icon--size-sm" aria-hidden="false" material-symbol="thumb_up" role="img" data-nosnippet="" translate="no" aria-label="Icon: Undefined" alt="Icon: Undefined" data-uid="678b0d07be19f">
                    </span>
            </span>
        
                    <span class="c-button__label-text ">
                Like
            </span>
        
    </span> </a>
            </div>
            </div>
</div>
    <div class="c-comment c-comment__is-reply"  data-uid="678b0d07be59e">

    <div class="c-comment__col">
            <!-- avatar.blade.php -->

    <div class="c-avatar c-avatar--size-md" data-uid="678b0d07be5d2">
        
        
                        <!-- image.blade.php -->
    <figure class="c-image c-avatar__image c-image--cover" aria-label="Peter Olsson" data-uid="678b0d07be62c">
         
            <img
    loading="lazy" 
    class="c-image__image" 
    src="https://picsum.photos/id/338/70/70" 
    alt="Peter Olsson"
    
/>                        </figure>
        
        
        
        
                
    </div>

    </div>

    <div class="c-comment__col">

        <div class="c-comment__top">

                <span class="c-link c-comment__link" id="" target="_top" data-uid="678b0d07c0bbd">
        <!-- typography.blade.php   original: h6 -->
<h3 class="c-typography c-comment__author c-typography__variant--h3" data-uid="678b0d07c0b82">
    Peter Olsson
</h3>
        </span>
        
                                <!-- typography.blade.php   original: span -->
<span class="c-typography c-comment__date c-typography__variant--meta" data-uid="678b0d07c0cb8">
    <span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="678b0d07c0c41" data-uid="678b0d07c0c41">
    <div class="c-tooltip__wrapper" tabindex="1" aria-describedby="678b0d07c0c41">
            <!-- typography.blade.php   original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="678b0d07c0c7a">
    1 år
</strong>                    <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="678b0d07c0c41">
             
            <div class="c-tooltip__content">
                <time class="2023-12-13T02:08:07 c-date" data-uid="678b0d07c0c0c">Wed 13 Dec 2023</time>
            </div>
            <span class="c-tooltip__arrow"></span>
                    </div>
    </div>
</span>
</span>                    </div>
    
        <div class="c-comment__bubble c-comment__bubble--color-dark">
                                <!-- typography.blade.php   original: p -->
<p class="c-typography c-comment__bubble--inner c-typography__variant--body" data-uid="678b0d07c0ceb">
    This is a reply comment text
</p>                
                    </div>

            </div>
</div>
    <div class="c-comment c-comment__is-reply"  data-uid="678b0d07c0d2a">

    <div class="c-comment__col">
            <!-- avatar.blade.php -->

    <div class="c-avatar c-avatar--size-md" data-uid="678b0d07c0d6d">
        
        
                        <!-- image.blade.php -->
    <figure class="c-image c-avatar__image c-image--cover" aria-label="Peter Olsson" data-uid="678b0d07c0da2">
         
            <img
    loading="lazy" 
    class="c-image__image" 
    src="https://picsum.photos/id/342/70/70" 
    alt="Peter Olsson"
    
/>                        </figure>
        
        
        
        
                
    </div>

    </div>

    <div class="c-comment__col">

        <div class="c-comment__top">

                <span class="c-link c-comment__link" id="" target="_top" data-uid="678b0d07c0e4b">
        <!-- typography.blade.php   original: h6 -->
<h4 class="c-typography c-comment__author c-typography__variant--h4" data-uid="678b0d07c0e1a">
    Peter Olsson
</h4>
        </span>
        
                                <!-- typography.blade.php   original: span -->
<span class="c-typography c-comment__date c-typography__variant--meta" data-uid="678b0d07c0f26">
    <span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="678b0d07c0eb8" data-uid="678b0d07c0eb8">
    <div class="c-tooltip__wrapper" tabindex="1" aria-describedby="678b0d07c0eb8">
            <!-- typography.blade.php   original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="678b0d07c0eee">
    just now
</strong>                    <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="678b0d07c0eb8">
             
            <div class="c-tooltip__content">
                <time class="2025-01-18T02:08:07 c-date" data-uid="678b0d07c0e8a">Sat 18 Jan 2025</time>
            </div>
            <span class="c-tooltip__arrow"></span>
                    </div>
    </div>
</span>
</span>                    </div>
    
        <div class="c-comment__bubble c-comment__bubble--color-dark">
                                <!-- typography.blade.php   original: p -->
<p class="c-typography c-comment__bubble--inner c-typography__variant--body" data-uid="678b0d07c0f57">
    This is a reply comment text, it was written now.
</p>                
                    </div>

            </div>
</div>
    <div class="c-comment c-comment__is-reply"  data-uid="678b0d07c0f96">

    <div class="c-comment__col">
            <!-- avatar.blade.php -->

    <div class="c-avatar c-avatar--size-md" data-uid="678b0d07c0fca">
        
        
                        <!-- image.blade.php -->
    <figure class="c-image c-avatar__image c-image--cover" aria-label="Peter Olsson" data-uid="678b0d07c0ffb">
         
            <img
    loading="lazy" 
    class="c-image__image" 
    src="https://picsum.photos/id/342/70/70" 
    alt="Peter Olsson"
    
/>                        </figure>
        
        
        
        
                
    </div>

    </div>

    <div class="c-comment__col">

        <div class="c-comment__top">

                <span class="c-link c-comment__link" id="" target="_top" data-uid="678b0d07c109d">
        <!-- typography.blade.php   original: h6 -->
<h5 class="c-typography c-comment__author c-typography__variant--h5" data-uid="678b0d07c106f">
    Peter Olsson
</h5>
        </span>
        
                                <!-- typography.blade.php   original: span -->
<span class="c-typography c-comment__date c-typography__variant--meta" data-uid="678b0d07c1180">
    <span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="678b0d07c110b" data-uid="678b0d07c110b">
    <div class="c-tooltip__wrapper" tabindex="1" aria-describedby="678b0d07c110b">
            <!-- typography.blade.php   original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="678b0d07c1147">
    2 minuter
</strong>                    <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="678b0d07c110b">
             
            <div class="c-tooltip__content">
                <time class="2025-01-18T02:06:07 c-date" data-uid="678b0d07c10db">Sat 18 Jan 2025</time>
            </div>
            <span class="c-tooltip__arrow"></span>
                    </div>
    </div>
</span>
</span>                    </div>
    
        <div class="c-comment__bubble c-comment__bubble--color-dark">
                                <!-- typography.blade.php   original: p -->
<p class="c-typography c-comment__bubble--inner c-typography__variant--body" data-uid="678b0d07c11b1">
    This is a reply comment text, it was written two minutes ago.
</p>                
                    </div>

            </div>
</div>
    <div class="c-comment c-comment__is-reply"  data-uid="678b0d07c11ed">

    <div class="c-comment__col">
            <!-- avatar.blade.php -->

    <div class="c-avatar c-avatar--size-md" data-uid="678b0d07c1221">
        
        
                        <!-- image.blade.php -->
    <figure class="c-image c-avatar__image c-image--cover" aria-label="Peter Olsson" data-uid="678b0d07c1253">
         
            <img
    loading="lazy" 
    class="c-image__image" 
    src="https://picsum.photos/id/64/70/70" 
    alt="Peter Olsson"
    
/>                        </figure>
        
        
        
        
                
    </div>

    </div>

    <div class="c-comment__col">

        <div class="c-comment__top">

                <span class="c-link c-comment__link" id="" target="_top" data-uid="678b0d07c12f2">
        <!-- typography.blade.php   original: h6 -->
<h6 class="c-typography c-comment__author c-typography__variant--h6" data-uid="678b0d07c12c6">
    Peter Olsson
</h6>
        </span>
        
                                <!-- typography.blade.php   original: span -->
<span class="c-typography c-comment__date c-typography__variant--meta" data-uid="678b0d07c13c8">
    <span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="678b0d07c135d" data-uid="678b0d07c135d">
    <div class="c-tooltip__wrapper" tabindex="1" aria-describedby="678b0d07c135d">
            <!-- typography.blade.php   original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="678b0d07c1391">
    5 timmar
</strong>                    <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="678b0d07c135d">
             
            <div class="c-tooltip__content">
                <time class="2025-01-17T21:08:07 c-date" data-uid="678b0d07c1330">Fri 17 Jan 2025</time>
            </div>
            <span class="c-tooltip__arrow"></span>
                    </div>
    </div>
</span>
</span>                    </div>
    
        <div class="c-comment__bubble c-comment__bubble--color-dark">
                                <!-- typography.blade.php   original: p -->
<p class="c-typography c-comment__bubble--inner c-typography__variant--body" data-uid="678b0d07c13f8">
    This is a reply comment text, it was written five hours ago.
</p>                
                    </div>

            </div>
</div>
    <div class="c-comment"  data-uid="678b0d07c1432">

    <div class="c-comment__col">
            <!-- avatar.blade.php -->

    <div class="c-avatar c-avatar--size-md" data-uid="678b0d07c1468">
        
        
        
        
        
        
                    <svg class="c-avatar__initials" aria-label="Peter Svensson" viewBox="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                <text font-size="380" y="50%" x="50%" fill="#fff" dominant-baseline="middle" text-anchor="middle" alignment-baseline="central">PS</text>
            </svg>
                
    </div>

    </div>

    <div class="c-comment__col">

        <div class="c-comment__top">

                <span class="c-link c-comment__link" id="" target="_top" data-uid="678b0d07c14c8">
        <!-- typography.blade.php   original: h6 -->
<h6 class="c-typography c-comment__author c-typography__variant--h6" data-uid="678b0d07c149d">
    Peter Svensson
</h6>
        </span>
        
                                <!-- typography.blade.php   original: span -->
<span class="c-typography c-comment__date c-typography__variant--meta" data-uid="678b0d07c15a8">
    <span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="678b0d07c1540" data-uid="678b0d07c1540">
    <div class="c-tooltip__wrapper" tabindex="1" aria-describedby="678b0d07c1540">
            <!-- typography.blade.php   original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="678b0d07c1571">
    1 år
</strong>                    <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="678b0d07c1540">
             
            <div class="c-tooltip__content">
                <time class="2024-01-18T02:08:07 c-date" data-uid="678b0d07c1507">Thu 18 Jan 2024</time>
            </div>
            <span class="c-tooltip__arrow"></span>
                    </div>
    </div>
</span>
</span>                    </div>
    
        <div class="c-comment__bubble c-comment__bubble--color-dark">
                
                            <div class="c-comment__bubble--inner">
                    This comment <u>content</u> was sent through the slot.
                </div>
                    </div>

            </div>
</div>
<?php 
    $labels = [
        'dateLabels' => [
            'year' => 'år',
            'month' => 'månad',
            'week' => 'vecka',
            'day' => 'dag',
            'hour' => 'timme',
            'minute' => 'minut',
            'second' => 'sekund'
            ],
        'dateLabelsPlural' => [
            'year' => 'år',
            'month' => 'månader',
            'week' => 'veckor',
            'day' => 'dagar',
            'hour' => 'timmar',
            'minute' => 'minuter',
            'second' => 'sekund'
        ]
    ];
?>



@comment([
    'author' => 'Peter Svensson',
    'author_url' => '#',
    'text' => 'This is a comment text',
    'icon' => 'face',
    'date' => date("Y-m-d H:i:s", strtotime('-2 years -6 months -3days -5 hours -10 minutes -20 seconds')),
    'dateLabels' => $labels['dateLabels'],
    'dateLabelsPlural' => $labels['dateLabelsPlural']
])
    @slot('actions')
        @button([
            'text' => 'Reply',
            'color' => 'default',
            'style' => 'basic',
            'href' => '#reply',
            'icon' => 'reply',
            'size' => 'sm'
        ])
        @endbutton

        @button([
            'text' => 'Like',
            'color' => 'default',
            'style' => 'basic',
            'href' => '#like',
            'icon' => 'thumb_up',
            'size' => 'sm'
        ])
        @endbutton
    @endslot
@endcomment

@comment([
    'author' => 'Peter Olsson',
    'text' => 'This is a reply comment text',
    'icon' => 'face',
    'author_image' => 'https://picsum.photos/id/338/70/70',
    'date' => date("Y-m-d H:i:s", strtotime('-1 year -1 month -5 days')),
    'is_reply' => true,
    'dateLabels' => $labels['dateLabels'],
    'dateLabelsPlural' => $labels['dateLabelsPlural']
])
@endcomment

@comment([
    'author' => 'Peter Olsson',
    'text' => 'This is a reply comment text, it was written now.',
    'icon' => 'face',
    'author_image' => 'https://picsum.photos/id/342/70/70',
    'date' => date("Y-m-d H:i:s"),
    'is_reply' => true,
    'dateLabels' => $labels['dateLabels'],
    'dateLabelsPlural' => $labels['dateLabelsPlural']
])
@endcomment

@comment([
    'author' => 'Peter Olsson',
    'text' => 'This is a reply comment text, it was written two minutes ago.',
    'icon' => 'face',
    'author_image' => 'https://picsum.photos/id/342/70/70',
    'date' => date("Y-m-d H:i:s", strtotime('-2 minutes')),
    'is_reply' => true,
    'dateLabels' => $labels['dateLabels'],
    'dateLabelsPlural' => $labels['dateLabelsPlural']
])
@endcomment

@comment([
    'author' => 'Peter Olsson',
    'text' => 'This is a reply comment text, it was written five hours ago.',
    'icon' => 'face',
    'author_image' => 'https://picsum.photos/id/64/70/70',
    'date' => date("Y-m-d H:i:s", strtotime('-5 hours')),
    'is_reply' => true,
    'dateLabels' => $labels['dateLabels'],
    'dateLabelsPlural' => $labels['dateLabelsPlural']
])
@endcomment

@comment([
    'author' => 'Peter Svensson',
    'date' => date("Y-m-d H:i:s", strtotime('-1 year')),
    'dateLabels' => $labels['dateLabels'],
    'dateLabelsPlural' => $labels['dateLabelsPlural']
])
    This comment <u>content</u> was sent through the slot.
@endcomment

Blade component parameters

Key Default value Type Available values Description
author string - Name of the commenter
author_url string - URL to the profile of the author
author_image string - A link to an image
text string - Content of the comment
icon string - Which icon to show
bubble_color dark string - Color for comment bubble background: light or dark
date 01/02/2019 string - The date when the comment was posted
date_suffix ago string - Time elapsed 'since'
dateLabels [] array - Array containing translations valid keys: year, month, week, day, hour, minute, second
dateLabelsPlural [] array - Array containing translations valid keys: year, month, week, day, hour, minute, second
componentElement div string - Element of the component
is_reply false boolean - If true the comment will be displayed as a reply
filterHtml false boolean - If set to true the comment will be filtered from html tags
allowedTags <b><strong><i><em><mark><small><del><ins><sub><sup> string - Which tags should be excluded from filtration
id string - The DOM id of the component.
classList [] array - Array containing wrapping classes array
attributeList [] array - Array containing keys and values rendered as attributes
containerAware false boolean true/false Makes the component container aware. Appends modifiers --size--xs/sm/md/lg to the component.
Settings location: /var/www/webroot/ROOT/vendor/helsingborg-stad/component-library/source/php/Component/Comment/comment.json