Show if a user is logged-in or not I want to display an array of users of my site in a view.

How do I show if a user is logged-in or offline? I can not find anything to do that in sight.
You can check $user->getLastAccessedTime() in a preprocess function and set this as a variable, for example the view at /admin/structure/views/view/who_s_online determines if someone is "online" by checking if last accessed time is within the last 15 minutes.

function mymodule_preprocess_views_view(&amp;$variables) {

  if ($variables['view']-&gt;id() == 'my_example_view') {
    /** @var $account \Drupal\user\UserInterface */
    $account = &lt;load up your user&gt;

    if ($account-&gt;isAuthenticated() &amp;&amp; time() - $account-&gt;lastAccessedTime() &lt; 900) {
      $variables['online'] = ['#markup' =&gt; 'online'];
    }
    else {
      $variables['online'] = ['#markup' =&gt; 'not online'];
    }
  }
}


And then to use 'online', you'd need to use a custom template for views-view-my-example-view.html.twig.

If you want to check a bunch of users, it may make more sense to use a view mode and use the preprocess function for the view mode.

The main point of this answer isn't how to theme views, but how to determine "online" as best as possible using Drupal.