Groovy script to show only selected item
You can use the Jenkins pipeline syntax to get the groovy script.  For example below code will generate radio buttons for active choice parameter. you can generate scripts like this from your jenkins instance at  http://localhost:8080/pipeline-syntax/. More info is here https://jenkins.io/doc/book/pipeline/getting-started/#snippet-generator

def createInputParameters(){
([[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false],
 parameters([[$class: 'ChoiceParameter', choiceType: 'PT_RADIO', description: '',
 filterLength: 1, filterable: false, name: 'Select_snapshot_or_release',
  randomName: 'choice-parameter-1683871426502398',
   script: [$class: 'GroovyScript', fallbackScript: [classpath: [], sandbox: true, 
    script: 'return "Error"'],
     script: [classpath: [], sandbox: true,
      script: '''return[
            \'snapshots\',\'release\']''']]]]),
             [$class: 'ThrottleJobProperty', categories: [],
              limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, 
               maxConcurrentTotal: 0,
               paramsToUseForLimit: '', throttleEnabled: false, throttleOption: 
               'project']])
      }