Skip to content

Accessibility: Full

Translations: Not Needed

Radio

Atomic radio element

Unchecked

Vue
html
<template>
  <HLSpace justify="flex-start" align="center">
    <HLRadio id="radio-unchecked" v-model="uncheckedValue" value="unchecked">Radio Label</HLRadio>
  </HLSpace>
</template>

<script setup>
  import { ref } from 'vue'
  const uncheckedValue = ref(false)
</script>

Checked

Vue
html
<template>
  <HLSpace justify="flex-start" align="center">
    <HLRadio id="radio-checked" v-model="checkedValue" value="checked" checked>Radio Label</HLRadio>
  </HLSpace>
</template>

<script setup>
  import { ref } from 'vue'
  const checkedValue = ref(true)
</script>

Disabled - Unchecked

Vue
html
<template>
  <HLSpace justify="flex-start" align="center">
    <HLRadio id="radio-disabled" disabled v-model="disabledValue" value="disabled">Radio Label</HLRadio>
  </HLSpace>
</template>

<script setup>
  import { ref } from 'vue'
  const disabledValue = ref(false)
</script>

Disabled - Checked

Vue
html
<template>
  <HLSpace justify="flex-start" align="center">
    <HLRadio id="radio-disabled-checked" disabled v-model="disabledCheckedValue" value="disabled-checked" checked>Radio Label</HLRadio>
  </HLSpace>
</template>

<script setup>
  import { ref } from 'vue'
  const disabledCheckedValue = ref(true)
</script>

Error state

Vue
html
<template>
  <HLFormItem validation-status="error">
    <HLRadio id="radio-error" v-model="errorValue" value="error">Remember me</HLRadio>
  </HLFormItem>
</template>

<script setup>
  import { ref } from 'vue'
  const errorValue = ref(false)
</script>

Only Icon

Vue
html
<template>
  <HLSpace justify="flex-start" align="center">
    <HLRadio id="radio-icon" v-model="onlyIconValue" value="icon" onlyIcon></HLRadio>
  </HLSpace>
</template>

<script setup>
  import { ref } from 'vue'
  const onlyIconValue = ref(false)
</script>

Imports

ts
import { HLRadio } from '@platform-ui/highrise'

Props

NameTypeDefaultDescription
id *string | undefinedundefinedThe unique identifier for the radio
checkedbooleanfalseWhether the radio is checked
disabledbooleanfalseWhether the radio is disabled
size'lg' | 'md' | 'sm' | 'xs' | '2xs' | '3xs''md'The size of the radio
valuestring | number | boolean | undefinedundefinedValue of the radio
namestring | undefinedundefinedThe name of the radio
onlyIconbooleanfalseShows only the radio button without label spacing

Emits

NameParametersDescription
@update:checked(value: boolean) => voidCallback when checked value changes
@change(event: Event) => voidWhen radio state changes

Slots

NameParametersDescription
default()The default content slot