fix(form): asterisks on Label.astro (#160)

This commit is contained in:
Woramat Ngamkham 2022-10-29 03:14:50 +07:00 committed by GitHub
parent 4b3e4c9f50
commit 5677222258
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,23 +14,26 @@ const { validators = [] } = control;
const isRequired: boolean = showValidationHints && validators.includes('validator-required');
---
{
{
control.label && control.labelPosition === 'left' && (
<label for={control.name}>
{isRequired && <span>*</span>}
<label for={control.name} data-validation-required={isRequired ? "true" : null}>
{control.label}
</label>
)
}
}
<slot />
<slot />
{
{
control.label && control.labelPosition === 'right' && (
<label for={control.name}>
{isRequired && <span>*</span>}
<label for={control.name} data-validation-required={isRequired ? "true" : null}>
{control.label}
</label>
)
}
}
<style>
label[data-validation-required="true"]::before {
content: "*";
}
</style>