GuidesComponentsHelpers

Conditional

Render children only when a boolean condition is true

  • Stable unknown
  • Release candidate since 1.16.1-rc.3
  • Development since 1.16.1-dev.2111+9796905

Conditional renders its children when condition is true and returns null otherwise. It does not add a wrapper view.

<Conditional condition={patient.birthDate != null}>
  <PatientCard.BirthDate>
    <PatientCard.BirthDate.Text birthDate={patient.birthDate!} variant="age" />
  </PatientCard.BirthDate>
</Conditional>

Use it for a readable branch in a component tree. Keep the condition explicit and avoid using it to hide required form validation or authorization decisions.

Last updated on