Pass Variable to Custom Block template file I want to create my custom block with custom content in Drupal 8,in start I create  Block with just simple text on it, and work correctly, my Problem is how can I pass my custom variable to it?
I saw some tutorial about it , my Module name is tcdev and this is content of .module file.

function tcdev_theme($existing, $type, $theme, $path) {
    return array('tcdev' =&gt;
        array(
            'variables' =&gt; array(
                'title' =&gt; 'Default title',
                'description' =&gt; null
            ),
            'template' =&gt; 'block--sliderblock'
        )
    );
}


and my SliderBlock.php 

    namespace  Drupal\tcdev\Plugin\Block;
use Drupal\Core\block\BlockBase;


/**
 * Provides a 'SliderBlock' block.
 *
 * @Block(
 * id = "slider_block",
 * admin_label = @Translation("Slider Block"),
 * )
 */

class SliderBlock extends BlockBase{
    /**
     * {@inheritdoc}
     */
    public function build(){
        return array(
            '#title' =&gt; 'my title ',
            '#description' =&gt; 'my custom desc'
        );
}
}


and finally my template file block--sliderblock.html.twig

  &lt;h2&gt;My Custom Block{{ title }}-{{ description }}&lt;/h2&gt;


But Result is only "My Custom Block-" .
The problem is variables not getting passed to template file,where is my fault?

appreciate any help
Your return array doesn't contain a #theme key. So at the moment you aren't using a template file at all.

And you  probably have a mix up between the outer block and theming the content inside of the block. Your template inside has the name tcdev, because that is the name you defined at the top of the array in *_theme(), and tcdev.html.twig is where your variables will end up.

Your code would look like the following one.

function tcdev_theme($existing, $type, $theme, $path) {
  return array('tcdev' =&gt;                  // this is the name of the template
           array(
            'variables' =&gt; array(
                'title' =&gt; 'Default title',
                'description' =&gt; null
            ),
        )
    );
}


SliderBlock.php

namespace  Drupal\tcdev\Plugin\Block;
use Drupal\Core\block\BlockBase;


/**
 * Provides a 'SliderBlock' block.
 *
 * @Block(
 * id = "slider_block",
 * admin_label = @Translation("Slider Block"),
 * )
 */

class SliderBlock extends BlockBase{
    /**
     * {@inheritdoc}
     */
    public function build() {
        return array(
            '#theme' =&gt; 'tcdev',
            '#title' =&gt; 'my title ',
            '#description' =&gt; 'my custom desc'
        );
   }
}


tcdev.html.twig

  &lt;h2&gt;My Custom Block{{ title }}-{{ description }}&lt;/h2&gt;


You wrote that you saw some tutorials about it. Probably this was about two different topics, and you are trying to apply them at the same time.


Create custom twig templates from custom module
Override Twig Templates


The custom template in the first link is tcdev.html.twig. What you are trying to do with the method in the second link is for block--sliderblock.html.twig.