Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Prefer the required flag

Pass required to a form field and it draws the mark itself, so the asterisk and validation stay in step.

Input with required
Show code
<app-input label="Email" required="true"></app-input>

Custom labels

Compose the mark beside a label you build yourself, never beside a field that already has required.

Email label with the mark
Email
Show code
<span class="label d-inline-flex align-items-center gap-1">Email<app-required-mark></app-required-mark></span>

Every option

Every value of every prop, one cell each.

no props

<app-required-mark> takes no props
Email

Guidance

What to do, and what to avoid.

Use it when

  • You compose a custom label for a required field the library does not own.
  • You need the same asterisk look outside AppInput / AppSelect and their siblings.

Reach for something else when

  • The field already accepts a required prop. → Pass required on the field
  • You want a status or count marker. → AppBadge
  • You need explanatory help beside the label. → AppInfoTip

One mark beside the label

Do
Company name

One asterisk flush against its label, using the shared mark.

Avoid
Company name *

A hand-rolled star drifts in colour and spacing from every library field.

Let the field own the mark

Do

Let the field own the mark via required.

Avoid

A star typed into the label of a required field doubles the mark: the field already draws one.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

Email
React, generated from the controls
<span className="label d-inline-flex align-items-center gap-1">
  Email
  <AppRequiredMark />
</span>
Razor, the same props
<span class="label d-inline-flex align-items-center gap-1">
  Email
  <app-required-mark></app-required-mark>
</span>

0 props.

Screen reader

2 notes
  • The asterisk is hidden from assistive technology with aria-hidden="true", so it is never read aloud.
  • Because the mark is hidden, the control itself must carry the required state: set required or aria-required on it.

Do and avoid

2 pairs

One mark beside the label

Do
Company name

One asterisk flush against its label, using the shared mark.

Avoid
Company name *

A hand-rolled star drifts in colour and spacing from every library field.

Let the field own the mark

Do

Let the field own the mark via required.

Avoid

A star typed into the label of a required field doubles the mark: the field already draws one.