Example:

$build['open_in_modal'] = [
      '#type' => 'link',
      '#url' =>Url::fromRoute('my-example-route'),
      '#title' => t('Open in fullscreen'),
      '#attributes' => [
        'class' => ['use-ajax'],
        'data-dialog-type' => 'full_screen',
      ],
      '#attached' => [
        'library' => ['core/drupal.dialog.ajax'],
      ],
    ];