feat(Checkbox/Radio/RadioGroup): add help slot

Resolves #1957
This commit is contained in:
Benjamin Canac
2024-07-23 16:16:51 +02:00
parent b264ad2ebd
commit c3122f776d
5 changed files with 22 additions and 6 deletions

View File

@@ -87,6 +87,10 @@ slots:
[Label]{.italic} [Label]{.italic}
:: ::
### `help` :u-badge{label="New" class="align-middle ml-2 !rounded-full" variant="subtle"}
Like the `#label` slot, use the `#help` slot to override the content of the help text.
## Props ## Props
:component-props :component-props

View File

@@ -126,6 +126,10 @@ slots:
[Label]{.italic} [Label]{.italic}
:: ::
### `help` :u-badge{label="New" class="align-middle ml-2 !rounded-full" variant="subtle"}
Like the `#label` slot, use the `#help` slot to override the content of the help text.
### `legend` ### `legend`
Use the `#legend` slot to override the content of the legend. Use the `#legend` slot to override the content of the legend.

View File

@@ -17,11 +17,13 @@
</div> </div>
<div v-if="label || $slots.label" :class="ui.inner"> <div v-if="label || $slots.label" :class="ui.inner">
<label :for="inputId" :class="ui.label"> <label :for="inputId" :class="ui.label">
<slot name="label">{{ label }}</slot> <slot name="label" :label="label">{{ label }}</slot>
<span v-if="required" :class="ui.required">*</span> <span v-if="required" :class="ui.required">*</span>
</label> </label>
<p v-if="help" :class="ui.help"> <p v-if="help || $slots.help" :class="ui.help">
{{ help }} <slot name="help" :help="help">
{{ help }}
</slot>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -16,11 +16,13 @@
</div> </div>
<div v-if="label || $slots.label" :class="ui.inner"> <div v-if="label || $slots.label" :class="ui.inner">
<label :for="inputId" :class="ui.label"> <label :for="inputId" :class="ui.label">
<slot name="label">{{ label }}</slot> <slot name="label" :label="label">{{ label }}</slot>
<span v-if="required" :class="ui.required">*</span> <span v-if="required" :class="ui.required">*</span>
</label> </label>
<p v-if="help" :class="ui.help"> <p v-if="help || $slots.help" :class="ui.help">
{{ help }} <slot name="help" :help="help">
{{ help }}
</slot>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -20,6 +20,10 @@
<template #label> <template #label>
<slot name="label" v-bind="{ option, selected: option.selected }" /> <slot name="label" v-bind="{ option, selected: option.selected }" />
</template> </template>
<template #help>
<slot name="help" v-bind="{ option, selected: option.selected }" />
</template>
</URadio> </URadio>
</fieldset> </fieldset>
</div> </div>