fix(form): asterisks on Label.astro (#160)
This commit is contained in:
parent
4b3e4c9f50
commit
5677222258
1 changed files with 22 additions and 19 deletions
|
@ -14,23 +14,26 @@ const { validators = [] } = control;
|
||||||
const isRequired: boolean = showValidationHints && validators.includes('validator-required');
|
const isRequired: boolean = showValidationHints && validators.includes('validator-required');
|
||||||
---
|
---
|
||||||
|
|
||||||
{
|
{
|
||||||
control.label && control.labelPosition === 'left' && (
|
control.label && control.labelPosition === 'left' && (
|
||||||
<label for={control.name}>
|
<label for={control.name} data-validation-required={isRequired ? "true" : null}>
|
||||||
{isRequired && <span>*</span>}
|
{control.label}
|
||||||
{control.label}
|
</label>
|
||||||
</label>
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
|
<slot />
|
||||||
|
|
||||||
|
{
|
||||||
|
control.label && control.labelPosition === 'right' && (
|
||||||
|
<label for={control.name} data-validation-required={isRequired ? "true" : null}>
|
||||||
|
{control.label}
|
||||||
|
</label>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
label[data-validation-required="true"]::before {
|
||||||
|
content: "*";
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
<slot />
|
|
||||||
|
|
||||||
{
|
|
||||||
control.label && control.labelPosition === 'right' && (
|
|
||||||
<label for={control.name}>
|
|
||||||
{isRequired && <span>*</span>}
|
|
||||||
{control.label}
|
|
||||||
</label>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue