Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/components/NcRadioGroup/NcRadioGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ const modelValue = defineModel<string>({ required: false, default: '' })

defineProps<{
/**
* Optional visual label of the radio group
* Label of the radio group (accessible name).
* It can be hidden visually if needed using `hidden-label` prop.
*/
label?: string
label: string

/**
* If set the label of the button group will not be shown visually but only for accessibility purposes.
*/
labelHidden?: boolean

/**
* Optional visual description of the radio group.
Expand Down Expand Up @@ -71,7 +77,7 @@ function onUpdate(value: string) {
:class="[{
[$style.radioGroup_buttonVariant]: buttonVariant,
}, $style.radioGroup]">
<legend v-if="label" :class="$style.radioGroup__label">
<legend :class="[$style.radioGroup__label, { 'hidden-visually': labelHidden }]">
{{ label }}
</legend>
<p v-if="description" :id="descriptionId" :class="$style.radioGroup__description">
Expand Down Expand Up @@ -174,7 +180,7 @@ The radio group also allows to create a button like styling together with the `N
<div>
<h4>With text labels</h4>
<div style="max-width: 400px">
<NcRadioGroup v-model="alignment">
<NcRadioGroup v-model="alignment" label="Example alignment" label-hidden>
<NcRadioGroupButton label="Start" value="start" />
<NcRadioGroupButton label="Center" value="center" />
<NcRadioGroupButton label="End" value="end" />
Expand All @@ -185,7 +191,7 @@ The radio group also allows to create a button like styling together with the `N

<h4>With icons</h4>
<div style="max-width: 250px">
<NcRadioGroup v-model="alignment">
<NcRadioGroup v-model="alignment" label="Example alignment with icons" label-hidden>
<NcRadioGroupButton aria-label="Start" value="start">
<template #icon>
<NcIconSvgWrapper directional :path="mdiAlignHorizontalLeft" />
Expand Down
Loading