Output all terms slugs for a loop filter

To print or to call all the slugs, you can use the following codes.

<?php 
$cats = get_the_terms(get_the_id(), 'your-taxonomy-id');
   if( is_array($cats) ){
      foreach ( $cats as $cat ) {
           echo $cat->slug.' ';
       }
   }
?>

For more details, follow the below link.
Add custom category name as data-filter to switch between these categories